Created
December 7, 2025 14:15
-
-
Save PrintNow/2ddb80cf536355df3b64e59fb5614e85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1.7 | |
| ################################################################################ | |
| # Builder | |
| ################################################################################ | |
| FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.25.3 AS builder | |
| WORKDIR /src | |
| # Go module | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| # 全量源码 | |
| COPY . . | |
| # buildx 注入 | |
| ARG TARGETOS | |
| ARG TARGETARCH | |
| # CI 元数据(给默认值,避免 set -u 炸) | |
| ARG GIT_TAG=unknown | |
| ARG GIT_COMMIT=unknown | |
| ARG GIT_TREE_STATE=dirty | |
| ARG BUILD_DATE=unknown | |
| ENV CGO_ENABLED=0 \ | |
| STATIC_BUILD=true | |
| RUN set -eux; \ | |
| BIN_NAME=argocd \ | |
| GOOS=${TARGETOS} \ | |
| GOARCH=${TARGETARCH} \ | |
| GIT_TAG=${GIT_TAG} \ | |
| GIT_COMMIT=${GIT_COMMIT} \ | |
| GIT_TREE_STATE=${GIT_TREE_STATE} \ | |
| BUILD_DATE=${BUILD_DATE} \ | |
| make argocd-all | |
| ################################################################################ | |
| # Final image | |
| ################################################################################ | |
| FROM gcr.io/distroless/base-debian12 | |
| COPY --from=builder /src/dist/argocd /usr/local/bin/argocd | |
| USER nonroot:nonroot | |
| ENTRYPOINT ["/usr/local/bin/argocd"] | |
Author
PrintNow
commented
Dec 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment