Skip to content

chore(ci): remove cleanup job #72

chore(ci): remove cleanup job

chore(ci): remove cleanup job #72

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
IMAGE_NAME: podmortem-log-parser
DOCKERFILE: ./src/main/docker/Dockerfile.native
DEP_STAGE: dependencies
jobs:
warm-cache:
name: Warm Dependencies Cache
runs-on: [self-hosted, linux]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Build dependencies stage
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
target: ${{ env.DEP_STAGE }}
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
cache-from: type=gha,scope=deps
cache-to: |
type=gha,mode=max,scope=deps
${{ github.event_name == 'push' && format('type=registry,ref=ghcr.io/{0}/{1}:deps-cache,mode=max', github.repository_owner, env.IMAGE_NAME) || '' }}
tags: |
${{ github.event_name == 'push' && format('ghcr.io/{0}/{1}:deps-cache', github.repository_owner, env.IMAGE_NAME) || '' }}
build-args: |
GITHUB_USER=${{ github.actor }}
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
test-build:
name: Test Build
if: github.event_name == 'pull_request'
needs: warm-cache
runs-on: [self-hosted, linux]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image for testing
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
platforms: linux/amd64
push: false
cache-from: |
type=gha,scope=deps
type=gha,scope=build-amd64
cache-to: type=gha,mode=max,scope=build-amd64
build-args: |
GITHUB_USER=${{ github.actor }}
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
build-arch:
name: Build ${{ matrix.arch }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: warm-cache
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: [self-hosted, linux]
- arch: arm64
platform: linux/arm64
runner: ubuntu-22.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 the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Build and push ${{ matrix.arch }} image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
platforms: ${{ matrix.platform }}
push: true
cache-from: |
type=gha,scope=deps
type=gha,scope=build-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=build-amd64
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-${{ matrix.arch }}
build-args: |
GITHUB_USER=${{ github.actor }}
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
create-manifest:
name: Create Multi-Arch Manifest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build-arch
runs-on: [self-hosted, linux]
permissions:
contents: read
packages: write
steps:
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Create and push multi-arch manifest
run: |
docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest-dev \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64
docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64