-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.zdap-proxy
25 lines (23 loc) · 1.02 KB
/
Dockerfile.zdap-proxy
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
FROM --platform=$BUILDPLATFORM golang:1.24.0-alpine3.21 AS golang
WORKDIR /src
#RUN apk add --no-cache tzdata ca-certificates
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
FROM golang AS builder
ARG TARGETOS
ARG TARGETARCH
ARG GO_LDFLAGS="-s -w"
ARG GO_BUILD_ARGS=" -trimpath"
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="${GO_LDFLAGS}" ${GO_BUILD_ARGS} -o /zdap-proxyd ./cmd/zdap-proxyd
FROM scratch
ENV TZ=UTC
# AFAICS, we shouln't need neither root-cert bundle or tz-db, for either proxy binary, but keep them commented for now so that it's quick&easy to add to the image, if it's needed.
#COPY --from=golang /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
#COPY --from=golang /usr/share/zoneinfo /usr/share/zoneinfo
USER 65534:65534
COPY --from=builder /zdap-*proxyd /
ENTRYPOINT [ "/zdap-proxyd" ]