Skip to content

Commit 6e66933

Browse files
authored
Merge pull request #274 from dgageot/build-misc
Misc changes to the build
2 parents 406d4e8 + 7aed58d commit 6e66933

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
# xx is a helper for cross-compilation
44
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.7.0 AS xx
55

6-
FROM --platform=$BUILDPLATFORM golang:1.25.0-alpine3.22 AS base
7-
RUN apk add clang file
6+
FROM --platform=$BUILDPLATFORM golang:1.25.1-alpine3.22 AS builder-base
87
COPY --from=xx / /
9-
ENV CGO_ENABLED=0
108
WORKDIR /src
11-
12-
FROM base AS builder-base
139
RUN --mount=type=cache,target=/go/pkg/mod \
1410
--mount=type=bind,source=go.mod,target=go.mod \
1511
--mount=type=bind,source=go.sum,target=go.sum \
@@ -30,7 +26,6 @@ RUN --mount=type=cache,target=/root/.cache,id=docker-ai-$TARGETPLATFORM \
3026
--mount=type=secret,id=telemetry_header,env=TELEMETRY_HEADER <<EOT
3127
set -ex
3228
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 .
33-
file /binaries/cagent-$TARGETos-$TARGETARCH
3429
xx-verify --static /binaries/cagent-$TARGETOS-$TARGETARCH
3530
if [ "$TARGETOS" = "windows" ]; then
3631
mv /binaries/cagent-$TARGETOS-$TARGETARCH /binaries/cagent-$TARGETOS-$TARGETARCH.exe

Taskfile.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,23 @@ tasks:
7373
desc: Build and Push Docker image
7474
cmd: docker buildx build --push -t docker/cagent {{.BUILD_ARGS}} .
7575

76-
build-agents:
77-
desc: Build Demo dockerized agents
76+
push-agent:
77+
desc: Build dockerized agent
78+
internal: true
7879
vars:
7980
DOCKER_ID:
8081
sh: curl -s --unix-socket ~/Library/Containers/com.docker.docker/Data/backend.sock http://_/registry/info | jq -r .id
8182
depends: ["build"]
82-
cmds:
83-
- ./bin/cagent build --push ./examples/pirate.yaml {{.DOCKER_ID}}/cagent-pirate
84-
- ./bin/cagent build --push ./examples/github.yaml {{.DOCKER_ID}}/cagent-github
85-
- ./bin/cagent build --push ./examples/gopher.yaml {{.DOCKER_ID}}/cagent-gopher
86-
- ./bin/cagent build --push ./examples/mem.yaml {{.DOCKER_ID}}/cagent-mem
83+
cmd: ./bin/cagent build --push ./examples/{{.AGENT}}.yaml {{.DOCKER_ID}}/cagent-{{.AGENT}}
84+
85+
push-agents:
86+
desc: Build dockerized agents
87+
deps:
88+
- task: push-agent
89+
vars: { AGENT: 'pirate' }
90+
- task: push-agent
91+
vars: { AGENT: 'github' }
92+
- task: push-agent
93+
vars: { AGENT: 'gopher' }
94+
- task: push-agent
95+
vars: { AGENT: 'mem' }

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/docker/cagent
22

3-
go 1.25.0
3+
go 1.25.1
44

55
require (
66
dario.cat/mergo v1.0.2

pkg/environment/secrets_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func writeSecret(value string) func(string) error {
1313
return func(path string) error {
14-
return os.WriteFile(path, []byte(value), 0700)
14+
return os.WriteFile(path, []byte(value), 0o700)
1515
}
1616
}
1717

0 commit comments

Comments
 (0)