Skip to content

Commit b23d894

Browse files
committed
Add multi-arch build/publish CI and build deps for arm64
1 parent 192dc4b commit b23d894

3 files changed

Lines changed: 83 additions & 2 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and publish multi-arch image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- keypairs
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v2
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v2
29+
with:
30+
registry: docker.io
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Build and push
35+
uses: docker/build-push-action@v4
36+
with:
37+
push: true
38+
platforms: linux/amd64,linux/arm64
39+
tags: |
40+
${{ secrets.DOCKERHUB_USERNAME }}/samfpy-client:latest
41+
${{ secrets.DOCKERHUB_USERNAME }}/samfpy-client:${{ github.sha }}
42+
file: Dockerfile
43+
context: .
44+

Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
FROM python:3.13-slim
22

3+
# Install runtime helper (xdg-utils) and temporary build tools so pip can
4+
# compile any packages that require native extensions (PyNaCl, kyber-py, etc.).
35
RUN apt-get update && apt-get install -y --no-install-recommends \
46
xdg-utils \
7+
build-essential \
8+
gcc \
9+
g++ \
10+
libffi-dev \
11+
libsodium-dev \
12+
libssl-dev \
13+
pkg-config \
14+
cargo \
15+
python3-dev \
516
&& rm -rf /var/lib/apt/lists/*
617

718
WORKDIR /app
819

920
COPY requirements.txt /app/requirements.txt
1021

22+
# Create virtualenv and install Python deps while build deps are present.
1123
RUN python -m venv /app/.venv \
12-
&& /app/.venv/bin/pip install --upgrade pip \
13-
&& /app/.venv/bin/pip install -r /app/requirements.txt
24+
&& /app/.venv/bin/pip install --upgrade pip setuptools wheel \
25+
&& /app/.venv/bin/pip install -r /app/requirements.txt \
26+
&& apt-get purge -y --auto-remove build-essential gcc g++ cargo python3-dev pkg-config libffi-dev libsodium-dev libssl-dev \
27+
&& rm -rf /var/lib/apt/lists/*
1428

1529
COPY . /app
1630

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
SAMFpy Client
2+
3+
This repository contains a TUI client and helper scripts.
4+
5+
# Docker multi-arch publishing
6+
7+
To publish a multi-arch image (linux/amd64 & linux/arm64) to Docker Hub via GitHub Actions:
8+
9+
1. Create Docker Hub repo: docker.io/<your-username>/samfpy-client
10+
2. Add GitHub repository secrets:
11+
- DOCKERHUB_USERNAME
12+
- DOCKERHUB_TOKEN
13+
3. Push to branch `main`, `master`, or `keypairs` to trigger the workflow. You can also run it manually via "Actions" -> "Build and publish multi-arch image" -> "Run workflow".
14+
15+
Or build locally with buildx:
16+
17+
```bash
18+
docker buildx create --use --bootstrap
19+
docker buildx build --platform linux/amd64,linux/arm64 -t USERNAME/samfpy-client:latest --push .
20+
```
21+
22+
If pip fails for arm64 due to missing wheels, ensure the Dockerfile includes the necessary system build dependencies (this repo already adds a conservative set: gcc, g++, libffi-dev, libsodium-dev, cargo, python3-dev).
23+

0 commit comments

Comments
 (0)