clessy-ng/Dockerfile
Hamcha 4b435d23bd
All checks were successful
continuous-integration/drone/push Build is passing
I will now present quotes from Aldo Giovanni and Giacomo until this docker issue is resolved
2022-03-25 20:50:05 +01:00

29 lines
No EOL
576 B
Docker

ARG GO_VERSION=1.18
# STAGE 1: building the executable
FROM golang:${GO_VERSION}-alpine AS build
RUN apk add --no-cache git
RUN apk --no-cache add ca-certificates
WORKDIR /src
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY ./ ./
# Build the executable
RUN CGO_ENABLED=0 go build \
-installsuffix 'static' \
-o /app .
# STAGE 2: build the container to run
FROM gcr.io/distroless/static AS final
LABEL maintainer="gbaeke"
USER nonroot:nonroot
# copy compiled app
COPY --from=build --chown=nonroot:nonroot /app /app
# run binary; use vector form
ENTRYPOINT ["/app"]