-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
31 lines (23 loc) · 806 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Build args
ARG BIN_NAME=go-mades-bench
ARG GO_VERSION=1.22
FROM golang:${GO_VERSION}-alpine AS build
WORKDIR /src
COPY ./ ./
RUN apk add --no-cache make
RUN go build -ldflags="-s -w" -o ./bin/${BIN_NAME} .
#FROM gcr.io/distroless/static AS final
FROM alpine:latest as final
# Build args
ARG BIN_NAME
# Use an unprivileged user.
RUN addgroup -S -g 65532 nonroot && adduser -D -S nonroot -G nonroot -u 65532
# add bash shell
RUN apk add --no-cache bash
USER nonroot:nonroot
# Copy our static executable
COPY --from=build --chown=nonroot:nonroot /src/bin/${BIN_NAME} /usr/bin/${BIN_NAME}
WORKDIR /go-mades-bench
# Sleep main container processes forever.
# Intended usecase, is to shell into the container and use the cli that way.
ENTRYPOINT ["/bin/bash", "-c", "while true; do sleep 86400; done;"]