-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (29 loc) · 882 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
45
46
ARG GOLANG_VERSION="1.23"
ARG PROJECT="gcp-oidc-token-proxy"
ARG TARGETOS
ARG TARGETARCH
ARG COMMIT
ARG VERSION
FROM --platform=${TARGETARCH} docker.io/golang:${GOLANG_VERSION} AS build
ARG PROJECT
WORKDIR /${PROJECT}
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY cmd/proxy cmd/proxy
ARG TARGETOS
ARG TARGETARCH
ARG COMMIT
ARG VERSION
RUN BUILD_TIME=$(date +%s) && \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-a \
-installsuffix cgo \
-ldflags "-X 'main.BuildTime=${BUILD_TIME}' -X 'main.GitCommit=${COMMIT}' -X 'main.OSVersion=${VERSION}'" \
-o /bin/proxy \
./cmd/proxy
FROM --platform=${TARGETARCH} gcr.io/distroless/static-debian12:latest
LABEL org.opencontainers.image.source=https://github.com/DazWilkin/gcp-oidc-token-proxy
COPY --from=build /bin/proxy /
ENTRYPOINT ["/proxy"]
CMD ["--port=7777"]