Skip to content

Instantly share code, notes, and snippets.

@jsonw23
Created April 4, 2022 20:22
Show Gist options
  • Save jsonw23/06097984f37e859f8a7e9ae879d86498 to your computer and use it in GitHub Desktop.
Save jsonw23/06097984f37e859f8a7e9ae879d86498 to your computer and use it in GitHub Desktop.
FROM golang:1.18
WORKDIR /usr/src/app
# pre-fetch the dependencies in a separate layer
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# copy in the full codebase and build
COPY . .
RUN go build -v -o /usr/local/bin/app ./
# open the default port and run the executable
EXPOSE 8080
CMD ["app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment