-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (24 loc) · 830 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
# Based on https://www.sethvargo.com/writing-github-actions-in-go/
#############################################################################
FROM golang:1.19 AS builder
RUN apt-get update && apt-get -y install upx
ENV CGO_ENABLED=0
WORKDIR /src
# These layers shouldn't change if there are no dependency changes
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN make binaries && \
strip bin/* && \
upx -q -9 bin/*
RUN echo "nobody:x:65534:65534:Nobody:/:" > /etc_passwd
#############################################################################
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc_passwd /etc/passwd
COPY --from=builder --chown=65534:0 /src/bin/ /bin/
USER nobody
ENV TZ=UTC
WORKDIR /
CMD ["/bin/slink-public-server"]