towerops/.forgejo/workflows/build-base.yaml
Graham McIntire ec8e32726b
Some checks failed
Build base image / Build and push base image (push) Failing after 2s
Production Deployment / Run ExUnit Tests (push) Failing after 1m0s
Production Deployment / Build and Push Docker Image (push) Has been skipped
Use Kaniko for Docker builds
2026-07-24 14:36:25 -05:00

61 lines
1.8 KiB
YAML

name: Build base image
on:
push:
branches:
- main
paths:
- 'k8s/Dockerfile.base'
- '.forgejo/workflows/build-base.yaml'
schedule:
- cron: '0 6 * * 0'
workflow_dispatch:
env:
REGISTRY: git.mcintire.me
IMAGE_NAME: graham/towerops-base
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-push:
name: Build and push base image
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: https://github.com/actions/checkout@v4
- name: Generate image tag
id: tag
run: |
DEBIAN=$(grep -E '^ARG DEBIAN_VERSION=' k8s/Dockerfile.base | head -1 | cut -d= -f2)
TIMESTAMP=$(date +%s)
TAG="debian-${DEBIAN}-${TIMESTAMP}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Build and push base image via Kaniko
uses: graham/infra/.forgejo/actions/kaniko-build@main
with:
dockerfile: k8s/Dockerfile.base
token: ${{ secrets.FORGEJO_TOKEN }}
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tag: ${{ steps.tag.outputs.tag }}
extra_args: "--build-arg CACHE_BUST=$(date -u +%G-W%V)"
- name: Tag as latest
uses: graham/infra/.forgejo/actions/kaniko-build@main
with:
dockerfile: k8s/Dockerfile.base
token: ${{ secrets.FORGEJO_TOKEN }}
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tag: latest
extra_args: ""
- name: Build summary
run: |
echo "### ✅ Base Image Built and Pushed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY