Piotr Biernat
4dab09e66b
All checks were successful
continuous-integration/drone/push Build is passing
27 lines
476 B
Docker
27 lines
476 B
Docker
# Builder
|
|
FROM golang:alpine AS builder
|
|
|
|
WORKDIR /go/src/app
|
|
|
|
ARG MAIN_GO=cmd/server/main.go
|
|
|
|
ARG SERVER_PORT=8080
|
|
ENV SERVER_PORT {$SERVER_PORT}
|
|
|
|
COPY go.mod go.sum ./
|
|
COPY internal ./internal
|
|
COPY cmd ./cmd
|
|
|
|
RUN ls -lh
|
|
|
|
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 $SERVER_PORT
|
|
ENTRYPOINT ["/app"]
|