mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
Simpler Dockerfile
Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
1 file changed
+1
-6
+1
-6
@@ -3,13 +3,9 @@
|
||||
# xx is a helper for cross-compilation
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.7.0 AS xx
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25.0-alpine3.22 AS base
|
||||
RUN apk add clang file
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25.0-alpine3.22 AS builder-base
|
||||
COPY --from=xx / /
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /src
|
||||
|
||||
FROM base AS builder-base
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
@@ -30,7 +26,6 @@ RUN --mount=type=cache,target=/root/.cache,id=docker-ai-$TARGETPLATFORM \
|
||||
--mount=type=secret,id=telemetry_header,env=TELEMETRY_HEADER <<EOT
|
||||
set -ex
|
||||
xx-go build -trimpath -ldflags "-s -w -X 'github.com/docker/cagent/pkg/version.Version=$GIT_TAG' -X 'github.com/docker/cagent/pkg/version.Commit=$GIT_COMMIT' -X 'github.com/docker/cagent/pkg/version.BuildTime=$BUILD_DATE' -X 'github.com/docker/cagent/pkg/telemetry.TelemetryEndpoint=$TELEMETRY_ENDPOINT' -X 'github.com/docker/cagent/pkg/telemetry.TelemetryAPIKey=$TELEMETRY_API_KEY' -X 'github.com/docker/cagent/pkg/telemetry.TelemetryHeader=$TELEMETRY_HEADER'" -o /binaries/cagent-$TARGETOS-$TARGETARCH .
|
||||
file /binaries/cagent-$TARGETos-$TARGETARCH
|
||||
xx-verify --static /binaries/cagent-$TARGETOS-$TARGETARCH
|
||||
if [ "$TARGETOS" = "windows" ]; then
|
||||
mv /binaries/cagent-$TARGETOS-$TARGETARCH /binaries/cagent-$TARGETOS-$TARGETARCH.exe
|
||||
|
||||
Reference in new issue
Block a user