Skip to content

Instantly share code, notes, and snippets.

@max-weis
Last active September 25, 2019 09:45
Show Gist options
  • Save max-weis/10ea322d9a334835ee3797ba22f59884 to your computer and use it in GitHub Desktop.
Save max-weis/10ea322d9a334835ee3797ba22f59884 to your computer and use it in GitHub Desktop.
# build stage
FROM golang:1.13-alpine as build
WORKDIR $GOPATH/app/
RUN apk add git
# copy and download dependencies
COPY go.* .
RUN go mod download
#compile app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o main
#resulting app
FROM scratch as final
COPY --from=build go/app/main /app/
WORKDIR /app
ENTRYPOINT [ "./main" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment