Configure build and cache for intermediate layers
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 1m5s
Check usage of free licenses / check-licenses (pull_request) Successful in 2m12s
Run unit tests / unit_tests (pull_request) Successful in 4m59s
Build Nginx-based docker image / build-static-assets (push) Successful in 17m31s

This commit is contained in:
Manuel Bustillo 2024-12-29 13:25:02 +01:00
parent d2841a449e
commit 9c3c766175

View File

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