Skip to content

Instantly share code, notes, and snippets.

@zeusro
Last active April 15, 2020 07:29
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 zeusro/516f5946af6a2770e89e1840047a08ec to your computer and use it in GitHub Desktop.
Save zeusro/516f5946af6a2770e89e1840047a08ec to your computer and use it in GitHub Desktop.
FROM golang:1.14.0-alpine3.11 as build-env
ADD . /src/github.com/${project}
# UFS cache
RUN apk update
WORKDIR /src/github.com/${project}
RUN GOARCH=amd64 CGO_ENABLED=0 go build -mod vendor -o ${app} github.com/${project}
# use the second image to minimize the size of the docker image
FROM alpine:3.11
COPY --from=build-env /src/github.com/${project}/${app} /app/${app}
WORKDIR /app
ENTRYPOINT ["/app/${app}"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment