Skip to content

Instantly share code, notes, and snippets.

@mohammad-quanit
Created March 21, 2023 18:59
Show Gist options
  • Save mohammad-quanit/4d33a811c0f0410c4fa47a6f9a4e246e to your computer and use it in GitHub Desktop.
Save mohammad-quanit/4d33a811c0f0410c4fa47a6f9a4e246e to your computer and use it in GitHub Desktop.
Golang Multi Container docker file
FROM golang:1.15-buster AS builder
EXPOSE 8000
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY greeter-server.go .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /opt/greeter-server
# final build
FROM alpine:latest
COPY --from=builder /opt/greeter-server /opt/greeter-server
ENTRYPOINT ["/opt/greeter-server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment