Publish docker agent image via GHCR workflow

This commit is contained in:
rcourtman 2025-10-10 07:44:34 +00:00
parent ba023f46aa
commit 7ab425b07a
3 changed files with 73 additions and 2 deletions

View file

@ -0,0 +1,59 @@
name: Build and Publish Docker Agent Image
on:
push:
branches:
- main
paths:
- 'Dockerfile'
- 'cmd/pulse-docker-agent/**'
- 'internal/dockeragent/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/docker-agent-image.yml'
release:
types: [published]
workflow_dispatch:
jobs:
build-agent-image:
name: Build & Push agent image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read version
id: version
run: |
VERSION=$(tr -d '\n' < VERSION)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push agent image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
target: agent_runtime
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: |
ghcr.io/${{ github.repository_owner }}/pulse-docker-agent:latest
ghcr.io/${{ github.repository_owner }}/pulse-docker-agent:${{ steps.version.outputs.version }}

View file

@ -45,7 +45,19 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
-trimpath \
-o pulse-docker-agent ./cmd/pulse-docker-agent
# Final stage
# Runtime image for the Docker agent (offered via --target agent_runtime)
FROM alpine:latest AS agent_runtime
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=backend-builder /app/pulse-docker-agent /usr/local/bin/pulse-docker-agent
COPY --from=backend-builder /app/VERSION /VERSION
ENTRYPOINT ["/usr/local/bin/pulse-docker-agent"]
# Final stage (Pulse server runtime)
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata su-exec

View file

@ -89,7 +89,7 @@ docker run -d \
ghcr.io/rcourtman/pulse-docker-agent:latest
```
> **Note**: The container image is published with the first release that includes the agent. Build locally if you are testing nightly builds.
> **Note**: Official images for `linux/amd64` and `linux/arm64` are published to `ghcr.io/rcourtman/pulse-docker-agent`. To test local changes, run `docker build --target agent_runtime -t pulse-docker-agent:test .` from the repository root.
## Configuration reference