Skip to content

Commit 0f6c319

Browse files
authored
Merge pull request #502 from sjefferson99/500-raspberry-pi-compatible-docker-images
feat: add support for multi-architecture Docker images with QEMU emul…
2 parents eb29aa6 + 18a0c23 commit 0f6c319

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

.github/workflows/build-and-push.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ jobs:
4848

4949
steps:
5050
- name: Checkout repository
51-
uses: actions/checkout@v4
51+
uses: actions/checkout@v7
52+
53+
# Registers QEMU binfmt handlers so Buildx can emulate arm64 on this
54+
# amd64 runner to produce multi-architecture images.
55+
- name: Set up QEMU
56+
uses: docker/setup-qemu-action@v4
57+
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v4
5260

5361
# GITHUB_TOKEN is automatically provided — no PAT or extra secret needed
5462
- name: Log in to GitHub Container Registry
55-
uses: docker/login-action@v3
63+
uses: docker/login-action@v4
5664
with:
5765
registry: ${{ env.REGISTRY }}
5866
username: ${{ github.actor }}
@@ -62,7 +70,7 @@ jobs:
6270

6371
- name: Extract metadata for aft (server)
6472
id: meta-server
65-
uses: docker/metadata-action@v5
73+
uses: docker/metadata-action@v6
6674
with:
6775
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/aft
6876
tags: |
@@ -78,10 +86,11 @@ jobs:
7886
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
7987
8088
- name: Build and push aft (server)
81-
uses: docker/build-push-action@v6
89+
uses: docker/build-push-action@v7
8290
with:
8391
context: .
8492
file: server/Dockerfile
93+
platforms: linux/amd64,linux/arm64
8594
# On a release event or push to main always push; on manual dispatch respect the input
8695
push: ${{ github.event_name == 'release' || github.event_name == 'push' || inputs.push_images == 'true' }}
8796
tags: ${{ steps.meta-server.outputs.tags }}
@@ -91,7 +100,7 @@ jobs:
91100

92101
- name: Extract metadata for aft-web
93102
id: meta-web
94-
uses: docker/metadata-action@v5
103+
uses: docker/metadata-action@v6
95104
with:
96105
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/aft-web
97106
tags: |
@@ -102,10 +111,11 @@ jobs:
102111
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
103112
104113
- name: Build and push aft-web (nginx + UI)
105-
uses: docker/build-push-action@v6
114+
uses: docker/build-push-action@v7
106115
with:
107116
context: .
108117
file: server/Dockerfile.nginx
118+
platforms: linux/amd64,linux/arm64
109119
push: ${{ github.event_name == 'release' || github.event_name == 'push' || inputs.push_images == 'true' }}
110120
tags: ${{ steps.meta-web.outputs.tags }}
111121
labels: ${{ steps.meta-web.outputs.labels }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ Available images:
6666
- `ghcr.io/sjefferson99/aft:latest` — API server only
6767
- `ghcr.io/sjefferson99/aft-web:latest` — nginx + UI (proxies to the server)
6868

69+
> **Raspberry Pi / arm64:** Both images are published as multi-architecture manifests covering `linux/amd64` and `linux/arm64`. The same `compose.example.yml` works unmodified on a Raspberry Pi or other arm64 host — `docker compose pull` automatically selects the matching architecture, no extra configuration needed.
70+
6971
### Server-only deployment
7072
Remove or comment out the `nginx` service in `compose.example.yml` before renaming it to `compose.yml` to run the API server without the web UI.
7173

docs/self-hosted-runner.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ completely free regardless of how many builds you run.
99
- Docker must be installed on the machine that will act as the runner
1010
- The machine must have internet access to reach GitHub and GHCR
1111
- Windows, Linux, or macOS are all supported
12+
- The runner's Docker daemon must allow privileged containers (used by
13+
`docker/setup-qemu-action` to register binfmt handlers for cross-building
14+
`linux/arm64` images, e.g. for Raspberry Pi)
1215

1316
---
1417

@@ -67,7 +70,12 @@ The workflow (`.github/workflows/build-and-push.yml`) triggers when you
6770
1. Push your code to `main` as normal
6871
2. When ready to cut a release, go to GitHub → **Releases****Draft a new release**
6972
3. Create a tag in semver format (e.g. `v1.2.0`) and publish
70-
4. The runner picks up the job, builds both images, and pushes to GHCR
73+
4. The runner picks up the job, builds both images for `linux/amd64` and
74+
`linux/arm64`, and pushes a single multi-arch manifest per tag to GHCR.
75+
`docker pull`/`docker compose pull` automatically grabs the right
76+
architecture, so the same images run on a Raspberry Pi without changes.
77+
The `arm64` leg is built via QEMU emulation, so builds take noticeably
78+
longer than amd64-only builds did.
7179

7280
Images will be available at:
7381
- `ghcr.io/sjefferson99/aft:latest` (and `ghcr.io/sjefferson99/aft:1.2.0`)

server/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ WORKDIR /app
88
# Using retries for better reliability with network issues
99
RUN apt-get update || apt-get update || apt-get update
1010
RUN apt-get install -y --no-install-recommends \
11-
gcc \
12-
default-libmysqlclient-dev \
1311
default-mysql-client \
14-
pkg-config \
15-
build-essential \
1612
curl && \
1713
apt-get clean && \
1814
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

0 commit comments

Comments
 (0)