46 lines
1.5 KiB
YAML
46 lines
1.5 KiB
YAML
name: '🐳 Builder Image'
|
|
|
|
# Reusable workflow: builds (and optionally pushes) the kpnpp-builder image.
|
|
# It is called by ci.yaml only when Dockerfile.builder or docs/requirements.txt
|
|
# change. It runs on the host runner (NOT inside the builder container) because
|
|
# it needs the Docker CLI/daemon.
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
push:
|
|
description: 'Push the built image to the registry'
|
|
type: boolean
|
|
default: true
|
|
workflow_dispatch:
|
|
inputs:
|
|
push:
|
|
description: 'Push the built image to the registry'
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: linux/amd64
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# No docker login step: the host runner was authenticated to
|
|
# gitea.tourolle.paris with `docker login` during setup, so its cached
|
|
# credentials in ~/.docker/config.json cover the push below.
|
|
- name: Build builder image
|
|
# Context is the repo root because Dockerfile.builder COPYs
|
|
# docs/requirements.txt during the build.
|
|
run: |
|
|
docker build \
|
|
-f Dockerfile.builder \
|
|
-t gitea.tourolle.paris/dtourolle/kpnpp-builder:latest \
|
|
-t gitea.tourolle.paris/dtourolle/kpnpp-builder:${{ github.sha }} \
|
|
.
|
|
|
|
- name: Push builder image
|
|
if: ${{ inputs.push }}
|
|
run: |
|
|
docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:latest
|
|
docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:${{ github.sha }}
|