FROM docker.io/library/golang:1 AS builder WORKDIR /usr/src/app COPY . ./ RUN CGO_ENABLED=0 go build -ldflags="-s -w" -a -installsuffix cgo -o bin/s3manager ./cmd/s3manager FROM docker.io/library/alpine:latest WORKDIR /usr/src/app RUN addgroup -S s3manager && adduser -S s3manager -G s3manager RUN apk add --no-cache \ ca-certificates \ dumb-init COPY --from=builder --chown=s3manager:s3manager /usr/src/app/bin/s3manager ./ COPY --from=builder --chown=s3manager:s3manager /usr/src/app/web ./web/ USER s3manager EXPOSE 8080 ENTRYPOINT [ "/usr/bin/dumb-init", "--" ] CMD [ "/usr/src/app/s3manager" ]