This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.16-alpine | |
WORKDIR /consul-template | |
RUN apk add --no-cache git | |
ENV CGO_ENABLED=0 \ | |
GO111MODULE=on \ | |
GOOS=linux \ | |
GOARCH=amd64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
_ "embed" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"os/exec" | |
"os/signal" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.. | |
FROM gcr.io/distroless/static:nonroot-amd64 | |
COPY --from=builder --chown=nonroot:nonroot /app ./ | |
USER nonroot | |
ENTRYPOINT ["./app"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
# Runs as root: | |
RUN apt-get update && apt-get -y upgrade | |
# Switch to non-root user: | |
RUN useradd --create-home appuser | |
WORKDIR /home/appuser | |
USER appuser | |
# Runs as non-root user: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"github.com/iovisor/gobpf/bcc" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
function update() { | |
for i in `asdf plugin list` | |
do | |
CURRENT_VERSION=`asdf current $i | awk '{print $2}'` | |
LATEST_VERSION=`asdf latest $i` | |
echo "Working with $i current version $CURRENT_VERSION but latest version is $LATEST_VERSION" | |
if [[ $(semver_check $LATEST_VERSION $CURRENT_VERSION) -lt 0 ]]; then | |
echo "Needs to update" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"crypto/x509/pkix" | |
"encoding/pem" | |
"fmt" | |
"math/big" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"exec" | |
"log" | |
"os" | |
) | |
// Pipeline strings together the given exec.Cmd commands in a similar fashion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the first stage, for building things that will be required by the | |
# final stage (notably the binary) | |
FROM golang | |
# Copy in just the go.mod and go.sum files, and download the dependencies. By | |
# doing this before copying in the other dependencies, the Docker build cache | |
# can skip these steps so long as neither of these two files change. | |
COPY go.mod go.sum ./ | |
RUN go mod download |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample from @citizen428 https://dev.to/citizen428/comment/6cmh | |
FROM golang:alpine as build | |
RUN apk add --no-cache ca-certificates | |
WORKDIR /build | |
ADD . . | |
RUN CGO_ENABLED=0 GOOS=linux \ | |
go build -ldflags '-extldflags "-static"' -o app | |
FROM scratch | |
COPY --from=build /etc/ssl/certs/ca-certificates.crt \ |