Skip to content

Instantly share code, notes, and snippets.

@jittuu
Created July 2, 2019 07:34
Show Gist options
  • Save jittuu/52e41234b57cc588a767435ee769e049 to your computer and use it in GitHub Desktop.
Save jittuu/52e41234b57cc588a767435ee769e049 to your computer and use it in GitHub Desktop.
Dockerfile for go web api
FROM golang:1.12 as builder
ADD . /app/api
WORKDIR /app/api
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -v -o api
FROM alpine
RUN apk --no-cache add ca-certificates
COPY --from=builder /app/api/api /api
CMD ["/api"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment