generated from actions/hello-world-docker-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
44 lines (30 loc) · 841 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
40
41
42
ARG GO_VER=1.23.1
ARG DEBIAN_VER=bookworm
FROM golang:${GO_VER}-${DEBIAN_VER} AS go-build
ENV USER=gh-action
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY pkg/ pkg/
COPY cmd/history-exporter/ ./
ENV CGO_ENABLED=0
RUN go build -v -o ./gh-action-history-exporter
FROM scratch
# Setup SSL certs
COPY --from=go-build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Setup user
COPY --from=go-build /etc/passwd /etc/group /etc/
USER gh-action:gh-action
# Copy the static executable
COPY --from=go-build /build/gh-action-history-exporter /gh-action-history-exporter
# Run the binary
ENTRYPOINT ["/gh-action-history-exporter"]