ci: fix building included images. #407
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Base image build | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
image: | |
- { dir: base, name: lnls-debian-11-epics-7 } | |
- { dir: base/musl, name: lnls-alpine-3-epics-7 } | |
env: | |
TAG: ${{ github.event_name == 'push' && github.ref_name || github.head_ref }} | |
REGISTRY: ghcr.io/${{ github.repository_owner }} | |
IMAGE: ${{ matrix.image.name }} | |
SOURCE: https://github.com/${{ github.repository }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Log in to registry | |
if: github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push tagged image | |
uses: docker/bake-action@v4 | |
with: | |
workdir: ${{ matrix.image.dir }} | |
files: docker-compose.yml | |
load: true | |
set: | | |
*.cache-from=type=gha,scope=${{ matrix.image.name }} | |
*.cache-to=type=gha,mode=max,scope=${{ matrix.image.name }} | |
push: ${{ github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' && github.ref_type == 'tag' }} | |
- name: Point IOC Dockerfile to image that was just built | |
run: sed -i "s/v.*-dev/$TAG/" Dockerfile | |
- name: Reconfigure builder to use docker driver | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker | |
- name: Build and push included IOC images | |
if: ${{ matrix.image.dir == 'base' }} | |
uses: docker/bake-action@v4 | |
with: | |
workdir: images/ | |
allow: fs.read=../Dockerfile | |
files: | | |
docker-compose-opcua.yml | |
docker-compose-motorpigcs2.yml | |
docker-compose-mca.yml | |
push: ${{ github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' && github.ref_type == 'tag' }} |