Skip to content

Commit

Permalink
ci: Redo arm runner switch
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Feb 5, 2025
1 parent 89c3e64 commit 64473aa
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 28 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/backend_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{matrix.os}}
permissions:
packages: write
concurrency:
group: build_push_docker_backend
group: ${{ matrix.platform }}-build_push_docker_backend
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
Expand All @@ -36,15 +43,48 @@ jobs:
context: backend
file: backend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
provenance: false
tags: |
ghcr.io/flathub-infra/backend:${{ github.sha }}
ghcr.io/flathub-infra/backend:latest
ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}-${{ matrix.platform }}
ghcr.io/${{ github.repository_owner }}/backend:latest-${{ matrix.platform }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
org.opencontainers.image.url=https://github.com/${{ github.repository }}
build-args: |
SENTRY_RELEASE=${{ github.sha }}
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max

docker-manifest:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- docker
permissions:
packages: write
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push backend manifest
run: |
docker manifest create \
ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }} \
--amend ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}
docker manifest create \
ghcr.io/${{ github.repository_owner }}/backend:latest \
--amend ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/backend:latest
50 changes: 45 additions & 5 deletions .github/workflows/backend_node_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{matrix.os}}
permissions:
packages: write
concurrency:
group: build_push_docker_backend_node_prod
group: ${{matrix.platform}}-build_push_docker_backend_node_prod
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
Expand All @@ -37,14 +44,47 @@ jobs:
file: backend-node/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
no-cache: true
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.platform }}
provenance: false
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
GITHUB_SHA=${{ github.sha }}
tags: |
ghcr.io/flathub-infra/backend-node:${{ github.sha }}
ghcr.io/flathub-infra/backend-node:latest
ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}-${{matrix.platform}}
ghcr.io/${{ github.repository_owner }}/backend-node:latest-${{matrix.platform}}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
org.opencontainers.image.url=https://github.com/${{ github.repository }}
docker-manifest:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- docker
permissions:
packages: write
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push backend-node manifest
run: |
docker manifest create \
ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }} \
--amend ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}
docker manifest create \
ghcr.io/${{ github.repository_owner }}/backend-node:latest \
--amend ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/backend-node:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/backend-node:latest
65 changes: 52 additions & 13 deletions .github/workflows/frontend_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,31 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{matrix.os}}
timeout-minutes: 80
permissions:
packages: write
concurrency:
group: build_push_docker_frontend_prod
group: ${{matrix.os}}-build_push_docker_frontend_prod
cancel-in-progress: true
steps:
# 2024-11-16: default-avail: 21G, needs: 20 GB, post-cleanup-avail: 53G
# 2025-02-02: needs: 20 GB, post-cleanup-avail: 57G
- name: Free up space
run: |
df -h|grep "/dev/root"
sudo rm -rf /opt/* /usr/local/.ghcup /swapfile
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet /usr/share/swift
sudo rm -rf /usr/local/share/boost /usr/local/share/powershell
sudo rm -rf /usr/lib/google-cloud-sdk /usr/lib/jvm
sudo du -xh --max-depth=3 / 2>/dev/null | sort -rh | head -40 || true
sudo rm -rf /usr/share/swift /usr/lib/jvm /opt/* \
/usr/lib/dotnet /usr/share/az_* /usr/local/lib/android \
/usr/local/lib/android /usr/share/dotnet \
/usr/local/share/boost /usr/local/share/powershell \
/usr/lib/google-cloud-sdk /var/lib/apt/lists/*
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
df -h|grep "/dev/root"
- uses: actions/checkout@v4
Expand All @@ -51,16 +57,49 @@ jobs:
file: frontend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
no-cache: true
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.platform }}
provenance: false
build-args: |
NEXT_PUBLIC_IS_PRODUCTION=true
ENABLE_SENTRY=true
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
GITHUB_SHA=${{ github.sha }}
tags: |
ghcr.io/flathub-infra/frontend:${{ github.sha }}
ghcr.io/flathub-infra/frontend:latest
ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-${{ matrix.platform }}
ghcr.io/${{ github.repository_owner }}/frontend:latest-${{ matrix.platform }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
org.opencontainers.image.url=https://github.com/${{ github.repository }}
docker-manifest:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- docker
permissions:
packages: write
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push frontend manifest
run: |
docker manifest create \
ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }} \
--amend ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}
docker manifest create \
ghcr.io/${{ github.repository_owner }}/frontend:latest \
--amend ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/frontend:latest
50 changes: 45 additions & 5 deletions .github/workflows/nginx_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-24.04
platform: amd64
- os: ubuntu-24.04-arm
platform: arm64
runs-on: ${{matrix.os}}
permissions:
packages: write
concurrency:
group: build_push_docker_nginx
group: ${{matrix.platform}}-build_push_docker_nginx
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
Expand All @@ -35,10 +42,11 @@ jobs:
context: nginx
file: nginx/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.platform }}
provenance: false
tags: |
ghcr.io/flathub-infra/nginx:${{ github.sha }}
ghcr.io/flathub-infra/nginx:latest
ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}-${{matrix.platform}}
ghcr.io/${{ github.repository_owner }}/nginx:latest-${{matrix.platform}}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
Expand All @@ -47,3 +55,35 @@ jobs:
SENTRY_RELEASE=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

docker-manifest:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- docker
permissions:
packages: write
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push nginx manifest
run: |
docker manifest create \
ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }} \
--amend ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}
docker manifest create \
ghcr.io/${{ github.repository_owner }}/nginx:latest \
--amend ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/nginx:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/nginx:latest

0 comments on commit 64473aa

Please sign in to comment.