31 lines
596 B
Docker
31 lines
596 B
Docker
# 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="catalog-worker"
|
|
LABEL vendor="Egommerce"
|
|
LABEL version="1.0"
|
|
|
|
WORKDIR /
|
|
COPY --from=builder $BIN_OUTPUT /
|
|
COPY .env.dist /.env
|
|
|
|
EXPOSE 80
|
|
ENTRYPOINT ["/worker"]
|