Skip to content

Instantly share code, notes, and snippets.

@timjonesdev
Last active February 18, 2019 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timjonesdev/b6360f92a24170e47e9aaa7745666b3e to your computer and use it in GitHub Desktop.
Save timjonesdev/b6360f92a24170e47e9aaa7745666b3e to your computer and use it in GitHub Desktop.
Scratch and Sniff
# -------------------------------------------------------
# Build the go source
# -------------------------------------------------------
FROM docker.io/golang:1.11 as go-builder
# copy simple go application into the container
COPY sniff.go $GOPATH/src/app/sniff.go
# change the working directory, for convenience
WORKDIR $GOPATH/src/app
# build the Go binary and create some directories to copy in later stages
RUN CGO_ENABLED=0 go build -o /go/bin/sniff ./sniff.go && \
echo "Sniff Binary built"
# -------------------------------------------------------
# Add the Go binary to scratch to create an enhanced base image
# -------------------------------------------------------
FROM scratch
# copy source files from go-builder stage into the scratch container
COPY --from=go-builder /go/bin/sniff /health
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment