-
Notifications
You must be signed in to change notification settings - Fork 122
/
Dockerfile
39 lines (31 loc) · 979 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
32
33
34
35
36
37
38
39
############################################################
# Build image
############################################################
FROM golang:1.22-alpine AS builder
ARG VERSION
ARG BUILT_AT
ARG COMMIT
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build \
-ldflags="-w -s \
-X main.version=$VERSION \
-X main.commit=$COMMIT \
-X main.builtAt=$BUILT_AT" \
-o ./bin/kminion
############################################################
# Runtime Image
############################################################
FROM alpine:3
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/bin/kminion /app/kminion
RUN addgroup -S redpanda \
&& adduser -S redpanda -G redpanda \
&& chmod o+rx /app/kminion \
&& apk upgrade --no-cache
USER redpanda
ENTRYPOINT ["/app/kminion"]