########### # BUILDER # ########### FROM golang:1.24.0 AS builder ARG VERSION ARG BUILT ARG GIT_COMMIT # private go packages ENV GOPRIVATE=code.30cm.net ENV FLAG="-s -w -X main.Version=${VERSION} -X main.Built=${BUILT} -X main.GitCommit=${GIT_COMMIT}" WORKDIR /app COPY . . RUN apt-get update && \ apt-get install -y git && \ mkdir /root/.ssh # Make the root foler for our ssh RUN --mount=type=secret,id=ssh_key,dst=/root/.ssh/id_rsa \ ssh-keyscan git.30cm.net >> /root/.ssh/known_hosts RUN --mount=type=ssh go mod download RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ -ldflags "$FLAG" \ -o permission ########## ## FINAL # ########## # FROM gcr.io/distroless/static-debian11 WORKDIR /app COPY --from=builder /app/permission /app/permission COPY --from=builder /app/etc/permission.yaml /app/etc/permission.yaml EXPOSE 8080 CMD ["/app/permission"]