rest-api-prototype/deploy/docker/Dockerfile.build
Piotr Biernat 4dab09e66b
All checks were successful
continuous-integration/drone/push Build is passing
[feature] Added CI config
2022-04-21 22:37:05 +02:00

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"]