Created
April 23, 2017 22:00
-
-
Save james2doyle/6489d3e60d994222ce0404c8cd500a93 to your computer and use it in GitHub Desktop.
Example Dockerfile for a Go (golang) project. Uses the official Debian image with the latest version of Go
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
| # Start from a Debian image with the latest version of Go installed | |
| # and a workspace (GOPATH) configured at /go. | |
| FROM golang | |
| # Copy the local package files to the container's workspace | |
| ADD . /go/src/github.com/username/program | |
| # bake in some environment variables? | |
| # ENV SOME_ENV "" | |
| # Set the working directory to avoid relative paths after this | |
| WORKDIR /go/src/github.com/username/program | |
| # Fetch the dependencies | |
| RUN go get . | |
| # build the binary to run later | |
| RUN go build | |
| # Run the command by default when the container starts | |
| ENTRYPOINT /go/bin/program | |
| # Document that the service listens on port 3000 | |
| EXPOSE 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment