Skip to content

Commit eaac8b9

Browse files
committed
Add arm support
1 parent f606fa1 commit eaac8b9

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ env:
2121
jobs:
2222
test:
2323
name: Run Tests
24-
runs-on: ubuntu-latest
24+
runs-on: ${{ matrix.runner }}
25+
strategy:
26+
matrix:
27+
include:
28+
- runner: ubuntu-latest
29+
arch: amd64
30+
- runner: ubuntu-24.04-arm64
31+
arch: arm64
2532

2633
steps:
2734
- name: Checkout code
@@ -30,7 +37,7 @@ jobs:
3037
- name: Set up Python
3138
uses: actions/setup-python@v5
3239
with:
33-
python-version: '3.11'
40+
python-version: '3.13'
3441
cache: 'pip'
3542

3643
- name: Install system dependencies
@@ -47,6 +54,10 @@ jobs:
4754
run: |
4855
pytest -v --tb=short
4956
57+
- name: Test summary
58+
run: |
59+
echo "✅ Tests passed on ${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
60+
5061
build-and-push:
5162
name: Build and Push Docker Image
5263
runs-on: ubuntu-latest
@@ -60,6 +71,9 @@ jobs:
6071
- name: Checkout code
6172
uses: actions/checkout@v4
6273

74+
- name: Set up QEMU
75+
uses: docker/setup-qemu-action@v3
76+
6377
- name: Set up Docker Buildx
6478
uses: docker/setup-buildx-action@v3
6579

@@ -95,6 +109,7 @@ jobs:
95109
uses: docker/build-push-action@v5
96110
with:
97111
context: .
112+
platforms: linux/amd64,linux/arm64
98113
push: true
99114
tags: ${{ steps.meta.outputs.tags }}
100115
labels: ${{ steps.meta.outputs.labels }}
@@ -105,6 +120,8 @@ jobs:
105120
run: |
106121
echo "### Docker Image Build Summary :rocket:" >> $GITHUB_STEP_SUMMARY
107122
echo "" >> $GITHUB_STEP_SUMMARY
123+
echo "**Platforms:** linux/amd64, linux/arm64" >> $GITHUB_STEP_SUMMARY
124+
echo "" >> $GITHUB_STEP_SUMMARY
108125
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
109126
echo '```' >> $GITHUB_STEP_SUMMARY
110127
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-slim
1+
FROM python:3.13-slim
22

33
ARG UID=1000
44
ARG GID=1000
@@ -10,6 +10,7 @@ RUN groupadd --force --gid $GID app \
1010
&& useradd --non-unique --home-dir /opt/app --create-home --uid $UID --gid $GID --comment "Application" app
1111

1212
# Install wkhtmltopdf and dependencies
13+
ARG TARGETARCH
1314
RUN apt-get update && apt-get install -y --no-install-recommends \
1415
wget \
1516
ca-certificates \
@@ -18,7 +19,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1819
libxrender1 \
1920
xfonts-75dpi \
2021
xfonts-base \
21-
&& wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -O /tmp/wkhtmltox.deb \
22+
&& case ${TARGETARCH} in \
23+
"amd64") WKHTML_ARCH=amd64 ;; \
24+
"arm64") WKHTML_ARCH=arm64 ;; \
25+
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
26+
esac \
27+
&& wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_${WKHTML_ARCH}.deb -O /tmp/wkhtmltox.deb \
2228
&& apt-get install -y /tmp/wkhtmltox.deb \
2329
&& rm /tmp/wkhtmltox.deb \
2430
&& apt-get remove -y wget \

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ A simple FastAPI REST application to run wkhtmltopdf.
77
### Docker
88
Use the provided Dockerfile or the built image at `ghcr.io/matbyte-com/htmltopdf-api`.
99

10+
**Supported Architectures:**
11+
- `linux/amd64` (x86_64)
12+
- `linux/arm64` (aarch64)
13+
1014
Available tags:
1115
- `latest` - Latest build from the main branch
1216
- `a.b.c` - Semantic version tags (e.g., `1.0.0`, `1.0`, `1`)
1317
- `<branch>-<sha>` - Branch-specific builds with git SHA
1418
- `<branch>` - Latest build from a specific branch
1519

20+
All images are multi-architecture and will automatically pull the correct version for your platform.
21+
1622
### Virtual Environment
1723

1824
- `python3 -m venv venv`
@@ -55,10 +61,10 @@ pytest --cov=main --cov-report=html
5561

5662
This project uses GitHub Actions for continuous integration and deployment:
5763

58-
- **Tests**: Run automatically on every push and pull request
59-
- **Docker Images**: Built and pushed to GitHub Container Registry only after tests pass
64+
- **Tests**: Run automatically on every push and pull request on both AMD64 and ARM64 architectures
65+
- **Docker Images**: Multi-architecture images (linux/amd64, linux/arm64) built and pushed to GitHub Container Registry only after tests pass on both architectures
6066
- **Tagging**: Images are automatically tagged with:
6167
- Git branch name
6268
- Git SHA
63-
- Semantic version tags
69+
- Semantic version tags in format `a.b.c` (e.g., `1.0.0`, `1.0`, `1`)
6470
- `latest` tag for the default branch

0 commit comments

Comments
 (0)