Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created April 23, 2017 22:00
Show Gist options
  • Select an option

  • Save james2doyle/6489d3e60d994222ce0404c8cd500a93 to your computer and use it in GitHub Desktop.

Select an option

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
# 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