Skip to main content

Docker

Docker Example Workflow

A complete GitHub Actions workflow using DxCore with Docker Buildx.

⚠️ Experimental: Docker support is experimental. APIs and behavior may change without notice.

Full Example

This workflow parallelizes Docker image builds across 2 agents using DxCore and Buildx bake.

name: Docker Build with DxCore
on: [push]
env:
DXCORE_URL: ${{ secrets.DXCORE_URL }}
DXCORE_TOKEN: ${{ secrets.DXCORE_TOKEN }}
jobs:
session:
runs-on: ubuntu-latest
outputs:
session_id: ${{ steps.create.outputs.session_id }}
steps:
- name: Create session
id: create
run: |
SESSION=$(dxcore ci create-session -c $DXCORE_URL -t $DXCORE_TOKEN)
echo "session_id=$SESSION" >> "$GITHUB_OUTPUT"
- name: Wait for coordinator
run: dxcore ci wait -c $DXCORE_URL --timeout 300
dispatch:
needs: session
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Dispatch build targets
run: |
docker buildx bake --print | dxcore dispatch \
-c $DXCORE_URL \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN -b docker
agent:
needs: session
runs-on: ubuntu-latest
strategy:
matrix:
shard: [0, 1]
steps:
- uses: actions/checkout@v4
- name: Login to registry
run: |
echo "${{ secrets.GHCR_TOKEN }}" | \
docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Run DxCore agent
run: |
dxcore agent \
-c $DXCORE_URL \
-a agent-${{ matrix.shard }} \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN -b docker
finish:
needs: [session, dispatch, agent]
if: always()
runs-on: ubuntu-latest
steps:
- name: Finish session
run: |
dxcore ci finish \
-c $DXCORE_URL \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN

Key Points

  • Registry login must happen before the agent starts, since agents execute docker buildx build --push
  • Buildx setup is required for multi-platform or advanced builder features
  • Docker builds are typically heavier than JS builds, so fewer agents may be needed

Note

Cross-target dependencies in your docker-bake.hcl are automatically respected. DxCore will not schedule a target until all its dependency targets have completed.

Next Steps