FROM golang:1.14 AS builder ARG version=dev WORKDIR /app COPY go.mod go.sum /app/ RUN go mod download COPY *go /app/ RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s -X main.version=${version}" -tags netgo -o /sendmail ./... FROM busybox:latest AS shell FROM gcr.io/distroless/static WORKDIR / COPY --from=builder /sendmail / COPY --from=shell /bin/cat /bin/date /bin/sh /bin/ COPY sendmail.sh /sendmail.sh ENTRYPOINT ["/sendmail.sh"]