Skip to content

Commit d79b1c7

Browse files
committed
feat(workflows): Delegate arm builds to ubuntu-24.04-arm runner
- Fix import in backend while at it
1 parent e4b7094 commit d79b1c7

File tree

2 files changed

+58
-26
lines changed

2 files changed

+58
-26
lines changed

.github/workflows/build-release.yaml

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@ on:
66
- web
77
workflow_dispatch:
88

9+
env:
10+
FRONTEND_IMAGE: ghcr.io/dk10ws/slcm-frontend
11+
BACKEND_IMAGE: ghcr.io/dk10ws/slcm-backend
12+
913
jobs:
1014
build:
1115
name: Build & Release Web version
12-
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
include:
19+
- arch: amd64
20+
runner: ubuntu-latest
21+
- arch: arm64
22+
runner: ubuntu-24.04-arm
23+
runs-on: ${{ matrix.runner }}
1324

1425
steps:
1526
- name: Checkout Repository
16-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
1728
with:
1829
ref: "web"
1930

@@ -27,36 +38,57 @@ jobs:
2738
- name: Set up Docker Buildx
2839
uses: docker/setup-buildx-action@v3
2940

30-
- name: Get metadata for frontend docker image
31-
id: meta-frontend
32-
uses: docker/metadata-action@v5
33-
with:
34-
images: ghcr.io/dk10ws/slcm-frontend
35-
3641
- name: Build and Push frontend Docker Image
3742
uses: docker/build-push-action@v6
3843
with:
3944
context: frontend
4045
push: true
41-
platforms: linux/amd64,linux/arm64
42-
tags: ${{ steps.meta-frontend.outputs.tags }}
43-
labels: ${{ steps.meta-frontend.outputs.tags }}
44-
cache-from: type=registry,ref=ghcr.io/dk10ws/slcm-frontend:buildcache
45-
cache-to: type=registry,ref=ghcr.io/dk10ws/slcm-frontend:buildcache,mode=max
46-
47-
- name: Get metadata for backend Docker image
48-
id: meta-backend
49-
uses: docker/metadata-action@v5
50-
with:
51-
images: ghcr.io/dk10ws/slcm-backend
46+
platforms: linux/${{ matrix.arch }}
47+
tags: |
48+
${{ env.FRONTEND_IMAGE }}:latest-${{ matrix.arch }}
49+
${{ env.FRONTEND_IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
5252

5353
- name: Build and Push backend Docker Image
5454
uses: docker/build-push-action@v6
5555
with:
5656
context: backend
5757
push: true
58-
platforms: linux/amd64,linux/arm64
59-
tags: ${{ steps.meta-backend.outputs.tags }}
60-
labels: ${{ steps.meta-backend.outputs.tags }}
61-
cache-from: type=registry,ref=ghcr.io/dk10ws/slcm-backend:buildcache
62-
cache-to: type=registry,ref=ghcr.io/dk10ws/slcm-backend:buildcache,mode=max
58+
platforms: linux/${{ matrix.arch }}
59+
tags: |
60+
${{ env.BACKEND_IMAGE }}:latest-${{ matrix.arch }}
61+
${{ env.BACKEND_IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
65+
merge-manifest:
66+
needs: build
67+
runs-on: ubuntu-latest
68+
69+
steps:
70+
- name: Log in to GitHub Container Registry
71+
uses: docker/login-action@v3
72+
with:
73+
registry: ghcr.io
74+
username: ${{ github.actor }}
75+
password: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- name: Set up Docker Buildx
78+
uses: docker/setup-buildx-action@v3
79+
80+
- name: Create multi-arch manifest for frontend
81+
run: |
82+
docker buildx imagetools create \
83+
-t ${{ env.FRONTEND_IMAGE }}:${{ github.sha }} \
84+
-t ${{ env.FRONTEND_IMAGE }}:latest \
85+
${{ env.FRONTEND_IMAGE }}:${{ github.sha }}-amd64 \
86+
${{ env.FRONTEND_IMAGE }}:${{ github.sha }}-arm64
87+
88+
- name: Create multi-arch manifest for backend
89+
run: |
90+
docker buildx imagetools create \
91+
-t ${{ env.BACKEND_IMAGE }}:${{ github.sha }} \
92+
-t ${{ env.BACKEND_IMAGE }}:latest \
93+
${{ env.BACKEND_IMAGE }}:${{ github.sha }}-amd64 \
94+
${{ env.BACKEND_IMAGE }}:${{ github.sha }}-arm64

backend/src/routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fastapi import APIRouter
22

33
from .models import ParentLogin, SlcmCookies, StudentLogin
4-
from .slcmswitch import SlcmSwitch
4+
from .SlcmSwitch import SlcmSwitch
55

66
router = APIRouter()
77
slcm = SlcmSwitch()
@@ -16,7 +16,7 @@ async def student_login(login: StudentLogin) -> dict[str, str]:
1616
@router.post("/login/parent")
1717
async def parent_login(login: ParentLogin) -> dict[str, str]:
1818
cookies = await slcm.parent_login(login.username)
19-
return cookies.to_dict()
19+
return cookies.model_dump(by_alias=True)
2020

2121

2222
@router.post("/login/parent/otp")

0 commit comments

Comments
 (0)