Skip to content

Commit 17fc0ab

Browse files
Merge pull request #173 from NatLibFi/use-docker-bake-action
Github workflow updates
2 parents ba3f11c + 19365bd commit 17fc0ab

3 files changed

Lines changed: 30 additions & 8 deletions

File tree

.github/actions/poetry/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Poetry'
2-
description: 'Install python poetry'
1+
name: "Poetry"
2+
description: "Install python poetry"
33

44
inputs:
55
version:

.github/workflows/test-build.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,33 @@ jobs:
287287
- name: Set up Docker Buildx
288288
uses: docker/setup-buildx-action@v3
289289

290-
- name: Build & Start container
291-
run: docker compose up -d --build ${{ matrix.image }}
290+
- name: Build and Load Docker Compose Images for Testing
291+
uses: docker/bake-action@v5
292+
with:
293+
files: docker-compose.yml
294+
load: true # CRITICAL: Load images into Docker daemon for 'docker compose up'
295+
set: |
296+
webapp.cache-from=type=gha,scope=buildkit-${{ github.run_id }}-webapp
297+
webapp.cache-to=type=gha,mode=max,scope=buildkit-${{ github.run_id }}-webapp
298+
scripts.cache-from=type=gha,scope=buildkit-${{ github.run_id }}-scripts
299+
scripts.cache-to=type=gha,mode=max,scope=buildkit-${{ github.run_id }}-scripts
300+
os.cache-from=type=gha,scope=buildkit-${{ github.run_id }}-os
301+
os.cache-to=type=gha,mode=max,scope=buildkit-${{ github.run_id }}-os
302+
build-args: |
303+
BUILD_PLATFORM=${{ matrix.platform }}
304+
# Pass the base image tag from the docker-image-build job
305+
BASE_IMAGE=${{ needs.docker-image-build.outputs.baseimage }}
306+
307+
- name: Start container stack
308+
# Now that all necessary images (webapp, scripts, os) are built and loaded
309+
# by the 'docker/bake-action', you just need to start the stack.
310+
# The '--build' flag is no longer necessary here.
311+
run: docker compose up -d
292312
env:
293-
BUILD_PLATFORM: ${{ matrix.platform }}
294-
BUILD_CACHE_FROM: type=gha,scope=buildkit-${{ github.run_id }}
295-
BUILD_BASE_IMAGE: ${{ needs.docker-image-build.outputs.baseimage }}
313+
BUILD_PLATFORM: ${{ matrix.platform }} # Still pass runtime env if needed
314+
# BUILD_CACHE_FROM is not relevant for 'up' commands, only for 'build'
315+
# BUILD_BASE_IMAGE is already passed as a build-arg above if needed for runtime
316+
296317

297318
- name: Run tests
298319
run: ./docker/ci/test_${{ matrix.image }}.sh ${{ matrix.image }}

docker/ci/test_scripts.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ source "${dir}/check_service_status.sh"
1313
wait_for_runit "$container"
1414

1515
# Make sure database initialization completed successfully
16-
timeout 240s grep -q 'Initialization complete' <(docker compose logs "$container" -f 2>&1)
16+
# This check is now handled implicitly by docker compose up -d waiting for the os service's healthcheck to pass.
17+
# timeout 240s grep -q 'Initialization complete' <(docker compose logs "$container" -f 2>&1)
1718

1819
# Make sure that cron is running in the scripts container
1920
check_service_status "$container" /etc/service/cron

0 commit comments

Comments
 (0)