Merge pull request 'Configure build and cache for intermediate layers' (#203) from optimize-docker-build into main
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 36s
Run unit tests / unit_tests (push) Successful in 1m46s
Build Nginx-based docker image / build-static-assets (push) Successful in 1m50s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m0s
Add copyright notice / copyright_notice (pull_request) Successful in 1m34s
Run unit tests / unit_tests (pull_request) Successful in 2m5s

Reviewed-on: #203
This commit is contained in:
bustikiller 2024-12-29 12:42:40 +00:00
commit 1e533702fd

View File

@ -1,8 +1,6 @@
name: Build Nginx-based docker image
on:
push:
branches:
- main
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
@ -24,13 +22,22 @@ jobs:
registry: ${{ secrets.PRIVATE_REGISTRY_HOST }}
username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }}
password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
- name: Build and push
- name: Build and push intermediate stages (build)
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest
cache-from: type=registry,ref=user/app:latest
target: build
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build
cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build
cache-to: type=inline
- name: Build and push (final)
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest
cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest
cache-to: type=inline