# Builder FROM golang:alpine AS builder ARG BIN_OUTPUT=/go/bin/worker ARG GO_WORKER=cmd/worker/main.go WORKDIR /go/src/app COPY src ./ RUN go mod download && \ export CGO_ENABLED=0 ; export GOOS=linux ; export GOARCH=amd64 && \ go build -ldflags="-w -s" -o $BIN_OUTPUT $GO_WORKER # Destination image - worker FROM gcr.io/distroless/base-debian10 ARG BIN_OUTPUT=/go/bin/worker LABEL author="Piotr Biernat" LABEL service="basket-worker" LABEL vendor="Egommerce" LABEL version="1.0" WORKDIR / COPY --from=builder $BIN_OUTPUT / COPY .env.dist /.env ENTRYPOINT ["/worker"]