Skip to content

πŸš€ Deploy frontend #2386

πŸš€ Deploy frontend

πŸš€ Deploy frontend #2386

name: πŸš€ Deploy frontend
on:
workflow_run:
workflows:
- 'Frontend CI'
branches:
- main
types: [completed]
workflow_dispatch:
jobs:
docker:
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: ${{matrix.platform}}-build_push_docker_frontend_prod
cancel-in-progress: true
steps:
# 2025-02-02: needs: 20 GB, post-cleanup-avail: 57G
- name: Free up space
run: |
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
df -h|grep "/dev/root"
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push production image
uses: docker/build-push-action@v6
with:
context: frontend
file: frontend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
no-cache: true
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/${{ 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