File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ARG PROJECT=volume-replicator
2+
3+ FROM golang:1.25.5-trixie AS build
4+
5+ ARG PROJECT
6+ ARG USER=$PROJECT
7+ ARG UID=1000
8+
9+ RUN adduser \
10+ --disabled-password \
11+ --gecos "" \
12+ --home "/nonexistent" \
13+ --shell "/sbin/nologin" \
14+ --no-create-home \
15+ --uid $UID \
16+ $USER
17+
18+ WORKDIR $GOPATH/src/$PROJECT/
19+ COPY . .
20+
21+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-w -s' -o /bin/main main.go
22+
23+ FROM scratch
24+
25+ ARG PROJECT
26+ WORKDIR /
27+
28+ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
29+ COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
30+ COPY --from=build /etc/passwd /etc/passwd
31+ COPY --from=build /etc/group /etc/group
32+
33+ WORKDIR /app
34+
35+ COPY --from=build /bin/main volume-replicator
36+
37+ USER $USER:$USER
38+
39+ ENTRYPOINT ["/app/volume-replicator" ]
40+
41+
42+
You can’t perform that action at this time.
0 commit comments