Last active
January 5, 2019 14:35
-
-
Save NiklasMerz/d8c50ed27f3b0393b3d688234e4f77fd to your computer and use it in GitHub Desktop.
Sample Dockerfile for building and running Go applications
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:alpine as builder | |
ENV PATH /go/bin:/usr/local/go/bin:$PATH | |
ENV GOPATH /go | |
COPY . /go/src/github.com/niklasmerz/myproject | |
RUN set -x \ | |
&& cd /go/src/github.com/niklasmerz/myproject \ | |
&& go build \ | |
&& mv myproject /usr/bin/myproject \ | |
&& rm -rf /go \ | |
&& echo "Build complete." | |
FROM alpine:latest | |
RUN apk add --no-cache \ | |
ca-certificates | |
COPY --from=builder /usr/bin/myproject /usr/bin/myproject | |
ENTRYPOINT [ "myproject" ] | |
CMD [ "" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment