vegvisir/Dockerfile.build
Piotr Biernat 6bc22c2b6b
All checks were successful
continuous-integration/drone/push Build is passing
[test] Multistage build with drone CI
2022-04-17 00:38:48 +02:00

23 lines
427 B
Docker

# Builder
FROM golang:alpine AS builder
WORKDIR /go/src/app
ARG MAIN_GO=pkg/main.go
# ARG HTTP_PORT=8080
# ENV HTTP_PORT {$HTTP_PORT}
COPY go.mod go.sum ./
COPY pkg ./pkg
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/app $MAIN_GO
# Destination image
FROM gcr.io/distroless/base-debian10
COPY --from=builder /go/bin/app /app
EXPOSE $HTTP_PORT
ENTRYPOINT ["/app"]