Skip to content

fix(actors): visibility rules (#3230) #258

fix(actors): visibility rules (#3230)

fix(actors): visibility rules (#3230) #258

name: Build and Push Docker Images
permissions:
contents: read
packages: write
on:
push:
tags:
- "v*"
workflow_dispatch:
# Cancel older in-progress runs for the same PR or the same ref (branch)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
UBUNTU_VERSION: "ubuntu-24.04"
jobs:
prepare:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
build: ${{ steps.version.outputs.build }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate version
id: version
run: |
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
echo "build=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build-frontend:
needs: prepare
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/frontend:${{ needs.prepare.outputs.version }}-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
build-backend:
needs: prepare
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create .meta file
run: |
echo "CISO_ASSISTANT_VERSION=${{ needs.prepare.outputs.version }}" > .meta
echo "CISO_ASSISTANT_BUILD=${{ needs.prepare.outputs.build }}" >> .meta
cp .meta ./backend/
cp .meta ./backend/ciso_assistant/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/backend:${{ needs.prepare.outputs.version }}-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
merge-manifests:
needs: [prepare, build-frontend, build-backend]
runs-on: ubuntu-24.04
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multi-arch manifests
run: |
# Frontend
docker buildx imagetools create -t ghcr.io/${{ github.repository }}/frontend:${{ needs.prepare.outputs.version }} \
-t ghcr.io/${{ github.repository }}/frontend:latest \
ghcr.io/${{ github.repository }}/frontend:${{ needs.prepare.outputs.version }}-amd64 \
ghcr.io/${{ github.repository }}/frontend:${{ needs.prepare.outputs.version }}-arm64
# Backend
docker buildx imagetools create -t ghcr.io/${{ github.repository }}/backend:${{ needs.prepare.outputs.version }} \
-t ghcr.io/${{ github.repository }}/backend:latest \
ghcr.io/${{ github.repository }}/backend:${{ needs.prepare.outputs.version }}-amd64 \
ghcr.io/${{ github.repository }}/backend:${{ needs.prepare.outputs.version }}-arm64