clessy-ng/Dockerfile
Hamcha fda955ad97
Some checks failed
continuous-integration/drone/push Build is failing
fix sourcehut blacklisting google
2023-01-10 09:40:08 +01:00

26 lines
No EOL
548 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 GOPRIVATE=git.sr.ht 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
# copy compiled app
COPY --from=build --chown=nonroot:nonroot /app /app
# run binary; use vector form
ENTRYPOINT ["/app"]