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. # Note: `push` is a STRING ("true"/"false"), not a boolean. Gitea's act_runner # mangles boolean inputs passed from an expression (they arrive as false), so we # pass an explicit string and compare with == 'true' below. on: workflow_call: inputs: push: description: 'Push the built image to the registry ("true"/"false")' type: string default: 'true' workflow_dispatch: inputs: push: description: 'Push the built image to the registry ("true"/"false")' type: string default: 'true' jobs: build: runs-on: linux/amd64 steps: # This job runs on the host (not in a container) so it can reach the # host Docker daemon and reuse the cached registry credentials. The host # has no Node, so the JS-based actions/checkout can't run here; do a # minimal shallow fetch of this commit with plain git instead. - name: Checkout repository run: | git init -q . git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" git -c http.extraheader="AUTHORIZATION: basic $(printf '%s' '${{ github.actor }}:${{ github.token }}' | base64 -w0)" \ fetch --depth 1 origin "${{ github.sha }}" git checkout -q FETCH_HEAD # 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 == 'true' }} run: | docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:latest docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:${{ github.sha }}