From fae33ba8e010b26654e6c121fe3723c4b04596db Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Fri, 7 Jun 2024 08:13:47 +0300 Subject: [PATCH] docker files --- .dockerignore | 3 +++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..98e94c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.vscode/* +vault-usage* +*.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..478a5a5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +ARG GO_IMAGE=docker.io/library/golang:1.22.4-bookworm +ARG BASE_IMAGE=gcr.io/distroless/static-debian12:debug-nonroot + +## --- + +FROM ${GO_IMAGE} as build +SHELL [ "/bin/sh", "-ec" ] + +ARG GOPROXY +ARG GOSUMDB +ARG GOPRIVATE + +ARG RELMODE + +WORKDIR /go/src + +COPY . . + +ENV GOMAXPROCS=4 \ + MALLOC_ARENA_MAX=4 + +RUN go env | grep -F -e GOPROXY -e GOSUMDB ; \ + make OUTDIR=/go/bin ; \ + make ci-clean + +## --- + +FROM ${BASE_IMAGE} + +COPY --from=build /go/bin/vault-usage /bin/ + +ENV GOMAXPROCS=4 \ + MALLOC_ARENA_MAX=4 + +ENTRYPOINT [ "/bin/vault-usage" ] +CMD [ ] + +USER nonroot:nonroot