-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (26 loc) · 877 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
43
44
FROM --platform=${BUILDPLATFORM} golang:1.19-alpine AS builder
RUN \
echo 'nobody:x:65534:65534:nobody:/:' > /tmp/passwd && \
echo 'nobody:x:65534:' > /tmp/group
RUN apk add --no-cache git
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY internal/ ./internal/
COPY stratus.go ./
ARG TARGETARCH
ARG TARGETOS
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} \
go build -installsuffix 'static' -o /app .
FROM gcr.io/distroless/base:debug AS final-base
RUN ["/busybox/sh", "-c", "ln -s /busybox/sh /bin/sh"]
COPY --from=builder /tmp/group /tmp/passwd /etc/
COPY --from=builder /app /bin/stratus
USER nobody:nobody
ENTRYPOINT ["/bin/sh"]
FROM gcr.io/distroless/static:latest AS final-static
COPY --from=builder /tmp/group /tmp/passwd /etc/
COPY --from=builder /app /bin/stratus
USER nobody:nobody
ENTRYPOINT ["/bin/stratus"]
CMD ["--help"]