Build multi-arch images in CI with native amd64 and arm64 runners
This commit is contained in:
+47
-9
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: amd64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -31,9 +31,15 @@ jobs:
|
|||||||
- name: Testy
|
- name: Testy
|
||||||
run: poetry run pytest -q
|
run: poetry run pytest -q
|
||||||
|
|
||||||
build-and-push:
|
# Každá architektura se staví NATIVNĚ na vlastním runneru (label = architektura):
|
||||||
|
# amd64 -> srv2-amd64-runner (SRV2), arm64 -> srv1-arm64-runner (SRV1, RPi 4).
|
||||||
|
# Žádná emulace (QEMU). Každý běh pushne image s příponou architektury.
|
||||||
|
build:
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [amd64, arm64]
|
||||||
|
runs-on: ${{ matrix.arch }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -57,10 +63,42 @@ jobs:
|
|||||||
echo '${{ secrets.REGISTRY_TOKEN }}' \
|
echo '${{ secrets.REGISTRY_TOKEN }}' \
|
||||||
| docker login gitea.doubynet.eu -u '${{ github.actor }}' --password-stdin
|
| docker login gitea.doubynet.eu -u '${{ github.actor }}' --password-stdin
|
||||||
|
|
||||||
- name: Build image
|
- name: Build image (${{ matrix.arch }})
|
||||||
run: docker build -t "$IMAGE:$MOVING_TAG" -t "$IMAGE:${{ github.sha }}" .
|
|
||||||
|
|
||||||
- name: Push image
|
|
||||||
run: |
|
run: |
|
||||||
docker push "$IMAGE:$MOVING_TAG"
|
docker build \
|
||||||
docker push "$IMAGE:${{ github.sha }}"
|
-t "$IMAGE:$MOVING_TAG-${{ matrix.arch }}" \
|
||||||
|
-t "$IMAGE:${{ github.sha }}-${{ matrix.arch }}" .
|
||||||
|
|
||||||
|
- name: Push image (${{ matrix.arch }})
|
||||||
|
run: |
|
||||||
|
docker push "$IMAGE:$MOVING_TAG-${{ matrix.arch }}"
|
||||||
|
docker push "$IMAGE:${{ github.sha }}-${{ matrix.arch }}"
|
||||||
|
|
||||||
|
# Spojí obě architektury pod jedno jméno tagu. `docker pull ...:devel` pak na
|
||||||
|
# amd64 i arm64 stroji sám vybere správnou variantu.
|
||||||
|
manifest:
|
||||||
|
needs: build
|
||||||
|
runs-on: amd64
|
||||||
|
steps:
|
||||||
|
- name: Název image a značka
|
||||||
|
run: |
|
||||||
|
echo "IMAGE=gitea.doubynet.eu/$(echo '${{ github.repository }}' \
|
||||||
|
| tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||||
|
if [ "${{ github.ref_name }}" = "release" ]; then
|
||||||
|
echo "MOVING_TAG=latest" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "MOVING_TAG=devel" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Přihlášení do Gitea registry
|
||||||
|
run: |
|
||||||
|
echo '${{ secrets.REGISTRY_TOKEN }}' \
|
||||||
|
| docker login gitea.doubynet.eu -u '${{ github.actor }}' --password-stdin
|
||||||
|
|
||||||
|
- name: Multi-arch manifest (moving tag + commit SHA)
|
||||||
|
run: |
|
||||||
|
for TAG in "$MOVING_TAG" "${{ github.sha }}"; do
|
||||||
|
docker manifest create --amend "$IMAGE:$TAG" \
|
||||||
|
"$IMAGE:$TAG-amd64" "$IMAGE:$TAG-arm64"
|
||||||
|
docker manifest push "$IMAGE:$TAG"
|
||||||
|
done
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ All notable changes to this project are documented in this file.
|
|||||||
and per-channel MPEG-TS streams for Jellyfin Live TV.
|
and per-channel MPEG-TS streams for Jellyfin Live TV.
|
||||||
- Docker Compose deployment (`Dockerfile`, `docker-compose.yml`) and configuration templates
|
- Docker Compose deployment (`Dockerfile`, `docker-compose.yml`) and configuration templates
|
||||||
(`channels.example.yaml`, `.env.example`).
|
(`channels.example.yaml`, `.env.example`).
|
||||||
|
- Gitea Actions CI (`.gitea/workflows/ci.yml`): ruff, mypy and pytest, then native `amd64` and `arm64` image builds on
|
||||||
|
separate runners (no emulation), merged into one multi-arch tag (`:devel` from `devel`, `:latest` from `release`,
|
||||||
|
plus a commit-SHA tag). Per-architecture tags carry an `-amd64` / `-arm64` suffix.
|
||||||
- Unit test suite covering config parsing, URL expiry parsing, ffmpeg argument building, playlist generation, and
|
- Unit test suite covering config parsing, URL expiry parsing, ffmpeg argument building, playlist generation, and
|
||||||
broadcast fan-out.
|
broadcast fan-out.
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ Initial implementation in place:
|
|||||||
aiohttp server (`/playlist.m3u`, `/stream/{channel_id}`, `/healthz`), config loading.
|
aiohttp server (`/playlist.m3u`, `/stream/{channel_id}`, `/healthz`), config loading.
|
||||||
- `serve.py` — entry point.
|
- `serve.py` — entry point.
|
||||||
- `Dockerfile` / `docker-compose.yml` — containerized deployment.
|
- `Dockerfile` / `docker-compose.yml` — containerized deployment.
|
||||||
|
- `.gitea/workflows/ci.yml` — CI: tests, then native `amd64` + `arm64` builds (one runner per architecture) merged
|
||||||
|
into a single multi-arch image in the Gitea registry.
|
||||||
- `channels.example.yaml`, `.env.example` — configuration templates.
|
- `channels.example.yaml`, `.env.example` — configuration templates.
|
||||||
- Unit tests for the pure/testable pieces (config parsing, URL expiry parsing, ffmpeg argument building, playlist
|
- Unit tests for the pure/testable pieces (config parsing, URL expiry parsing, ffmpeg argument building, playlist
|
||||||
generation, broadcast fan-out).
|
generation, broadcast fan-out).
|
||||||
|
|||||||
Reference in New Issue
Block a user