From dfaf54aad3dcf320afe974208c1dc1faab79cf71 Mon Sep 17 00:00:00 2001 From: Jonas Hagberg Date: Fri, 3 Jan 2025 12:49:14 +0100 Subject: [PATCH] Refactor Docker image build process in create_packages.yml - Updated the workflow to remove specific Dockerfile paths from the filters, focusing on directory-based builds for frontend, main, and r-api services. - Changed the build command to use the --no-cache option, ensuring fresh builds on the production branch. - Improved the overall efficiency of the CI/CD pipeline by refining the conditions for building images based on branch context. These changes enhance the clarity and performance of the Docker image management process, ensuring that builds are more reliable and streamlined. --- .github/workflows/create_packages.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_packages.yml b/.github/workflows/create_packages.yml index 4cea834d..c100ed18 100644 --- a/.github/workflows/create_packages.yml +++ b/.github/workflows/create_packages.yml @@ -32,14 +32,12 @@ jobs: filters: | frontend: - 'frontend/**' - - 'docker/frontend.Dockerfile' + - '.docker/frontend' main: - 'app/**' - - 'docker/main.Dockerfile' - '.docker/main' r-api: - 'R/**' - - 'docker/r-api.Dockerfile' - '.docker/r-api' build: @@ -89,7 +87,7 @@ jobs: run: | # Only build on production branch, tags will just retag existing images if [[ "${{ github.ref_name }}" == "production" ]]; then - docker compose build --build-arg BUILDKIT_INLINE_CACHE=1 herdbook-frontend main + docker compose build --no-cache --build-arg BUILDKIT_INLINE_CACHE=1 herdbook-frontend main elif [[ "${{ github.ref_type }}" != "tag" ]]; then # For other branches (except tags), only build changed images and their dependents if [[ "${{ needs.changes.outputs.frontend }}" == "true" ]]; then