Skip to content

Instantly share code, notes, and snippets.

@bscott
Created January 28, 2021 05:28
Show Gist options
  • Save bscott/88c42cc2c4135ab8ba83a391f697a024 to your computer and use it in GitHub Desktop.
Save bscott/88c42cc2c4135ab8ba83a391f697a024 to your computer and use it in GitHub Desktop.
Go Dockerfile
FROM golang:1.15-alpine AS build
RUN apk add --no-cache git
WORKDIR /go/src/project
COPY . /go/src/project
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/index <PROJECT PATH>
FROM scratch
COPY --from=build /bin/index /bin/index
EXPOSE 8080
CMD ["/bin/index"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment