-
-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (73 loc) · 2.49 KB
/
build-master-cache.yaml
File metadata and controls
83 lines (73 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Build Master Cache
on:
push:
branches:
- master
paths:
- "apps/api/composer.json"
- "apps/api/composer.lock"
- "apps/api/src/**"
- "apps/api/public/**"
- "apps/web/package.json"
- "apps/web/package-lock.json"
- "apps/web/public/**"
- "infrastructure/docker/**"
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ${{ github.repository }}
jobs:
build-cache:
name: Build Master Cache
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build stage: Documentation compilation
- name: Build documentation image cache
uses: docker/build-push-action@v7
with:
context: .
file: ./infrastructure/docker/build/Dockerfile
build-args: |
BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-base:latest
push: true
cache-from: type=gha,scope=build-master
cache-to: type=gha,mode=max,scope=build-master
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-build:master
# Runtime: Web image
- name: Build web image cache
uses: docker/build-push-action@v7
with:
context: .
file: ./infrastructure/docker/runtime/web/Dockerfile
build-args: |
BUILD_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-build:master
push: true
cache-from: type=gha,scope=web-master
cache-to: type=gha,mode=max,scope=web-master
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-web:master
# Runtime: API image
- name: Build API image cache
uses: docker/build-push-action@v7
with:
context: .
file: ./infrastructure/docker/runtime/api/Dockerfile
build-args: |
BUILD_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-build:master
BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-base:latest
push: true
cache-from: type=gha,scope=api-master
cache-to: type=gha,mode=max,scope=api-master
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-api:master