Skip to content

Commit 4c9ef61

Browse files
committed
build-image
Signed-off-by: Jean-Laurent de Morlhon <jeanlaurent@morlhon.net>
1 parent ab6f7b2 commit 4c9ef61

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,38 @@ jobs:
9595
TELEMETRY_API_KEY: ${{ secrets.TELEMETRY_API_KEY }}
9696
TELEMETRY_ENDPOINT: ${{ secrets.TELEMETRY_ENDPOINT }}
9797
TELEMETRY_HEADER: ${{ secrets.TELEMETRY_HEADER }}
98+
99+
build-image:
100+
# remove once this works on main
101+
# if: startsWith(github.ref, 'refs/tags/v')
102+
needs: [build]
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
107+
108+
- name: Set up QEMU
109+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
110+
111+
- name: Hub login
112+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
113+
with:
114+
username: ${{ vars.DOCKERBUILDBOT_USERNAME }}
115+
password: ${{ secrets.DOCKERBUILDBOT_WRITE_PAT }}
116+
117+
- name: Set up Docker Buildx
118+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
119+
with:
120+
version: "lab:latest"
121+
driver: cloud
122+
endpoint: "docker/make-product-smarter"
123+
install: true
124+
125+
- name: Install Task
126+
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
127+
with:
128+
repo-token: ${{ secrets.GITHUB_TOKEN }}
129+
version: 3.x
130+
131+
- name: Build
132+
run: task build-image

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ COPY --from=builder /binaries/cagent-$TARGETOS-$TARGETARCH cagent
8484

8585
FROM scratch AS cross
8686
COPY --from=builder /binaries .
87+
88+
FROM alpine:3.22@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
89+
RUN apk add --no-cache curl socat
90+
COPY --from=build-agent /agent /
91+
ENTRYPOINT [ "/agent" ]

Taskfile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ tasks:
6363
cross:
6464
desc: Build binaries for multiple platforms
6565
cmd: docker buildx build --target=cross {{.BUILD_ARGS}} --platform linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64 --output=./dist .
66+
67+
build-image:
68+
desc: Build Docker image
69+
cmd: docker buildx build -t docker/cagent:latest {{.BUILD_ARGS}} .

0 commit comments

Comments
 (0)