25 lines
442 B
Docker
25 lines
442 B
Docker
# Builder
|
|
FROM golang:alpine AS builder
|
|
|
|
WORKDIR /go/src/app
|
|
|
|
ARG MAIN_GO=cmd/main.go
|
|
|
|
COPY src ./
|
|
|
|
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
|
|
|
|
LABEL author="Piotr Biernat"
|
|
LABEL vendor="Egommerce"
|
|
LABEL version="1.0"
|
|
|
|
COPY --from=builder /go/bin/app /app
|
|
COPY .env.dist /.env
|
|
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/app"]
|