-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (20 loc) · 691 Bytes
/
Dockerfile
File metadata and controls
31 lines (20 loc) · 691 Bytes
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 1
FROM golang:1.25.8-alpine3.23 AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -ldflags "-X main.version=v1.9.3" -o poke-cli .
# build 2
FROM --platform=$BUILDPLATFORM alpine:3.23
# Installing only necessary packages and remove them after use
RUN apk add --no-cache shadow=4.18.0-r0 && \
addgroup -S poke_group && adduser -S poke_user -G poke_group && \
sed -i 's/^root:.*/root:!*:0:0:root:\/root:\/sbin\/nologin/' /etc/passwd && \
apk del shadow
COPY --from=build /app/poke-cli /app/poke-cli
ENV TERM=xterm-256color
ENV COLOR_OUTPUT=true
RUN chown -R poke_user:poke_group /app
USER poke_user
ENTRYPOINT ["/app/poke-cli"]