-
-
Save thelebster/08d5523104dbb0b15f61b4192a38f7b1 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