docker files

This commit is contained in:
Konstantin Demin 2024-06-07 08:13:47 +03:00
parent 224ad208f1
commit fae33ba8e0
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0
2 changed files with 41 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
.vscode/*
vault-usage*
*.md

38
Dockerfile Normal file
View File

@ -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