1212 types : [published]
1313 workflow_dispatch :
1414
15+ concurrency :
16+ group : ${{ github.workflow }}-${{ github.ref }}
17+ cancel-in-progress : true
18+
1519env :
1620 REGISTRY : ghcr.io
1721 API_IMAGE : ${{ github.repository }}-api
2024 NEXT_PUBLIC_PORT : 7443
2125
2226jobs :
23- build-and-push :
27+ build-and-push-api :
2428 runs-on : ubuntu-latest
2529 permissions :
2630 contents : read
2731 packages : write
2832
2933 steps :
3034 - name : Checkout repository
31- uses : actions/checkout@v4
35+ uses : actions/checkout@v6
3236 with :
3337 fetch-depth : 0
3438 ssh-key : ${{ secrets.DEPLOY_KEY }}
3539
36- - name : Create .env files
37- run : |
38- cp .env.sample api/.env
39- cp .env.sample view/.env
40+ - name : Create .env file
41+ run : cp .env.sample api/.env
4042
4143 - name : Set up Docker Buildx
4244 uses : docker/setup-buildx-action@v3
43-
44- - name : Cache Docker layers
45- uses : actions/cache@v4
4645 with :
47- path : /tmp/.buildx-cache
48- key : ${{ runner.os }}-buildx-${{ github.sha }}
49- restore-keys : |
50- ${{ runner.os }}-buildx-
46+ platforms : linux/amd64,linux/arm64
47+ driver-opts : |
48+ image=moby/buildkit:latest
49+ network=host
5150
5251 - name : Log in to the Container registry
5352 uses : docker/login-action@v3
@@ -72,17 +71,44 @@ jobs:
7271 with :
7372 context : ./api
7473 push : true
74+ platforms : linux/amd64,linux/arm64
7575 tags : ${{ steps.meta-api.outputs.tags }}
7676 labels : ${{ steps.meta-api.outputs.labels }}
7777 build-args : |
7878 API_PORT=${{ env.API_PORT }}
79- cache-from : type=local,src=/tmp/.buildx-cache
80- cache-to : type=local,dest=/tmp/.buildx-cache-new
79+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.API_IMAGE }}:buildcache
80+ cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.API_IMAGE }}:buildcache,mode=max
81+
82+ build-and-push-view :
83+ runs-on : ubuntu-latest
84+ permissions :
85+ contents : read
86+ packages : write
8187
82- - name : Move cache
83- run : |
84- rm -rf /tmp/.buildx-cache
85- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
88+ steps :
89+ - name : Checkout repository
90+ uses : actions/checkout@v4
91+ with :
92+ fetch-depth : 0
93+ ssh-key : ${{ secrets.DEPLOY_KEY }}
94+
95+ - name : Create .env file
96+ run : cp .env.sample view/.env
97+
98+ - name : Set up Docker Buildx
99+ uses : docker/setup-buildx-action@v3
100+ with :
101+ platforms : linux/amd64,linux/arm64
102+ driver-opts : |
103+ image=moby/buildkit:latest
104+ network=host
105+
106+ - name : Log in to the Container registry
107+ uses : docker/login-action@v3
108+ with :
109+ registry : ${{ env.REGISTRY }}
110+ username : ${{ github.actor }}
111+ password : ${{ secrets.GITHUB_TOKEN }}
86112
87113 - name : Extract metadata for View
88114 id : meta-view
@@ -100,14 +126,10 @@ jobs:
100126 with :
101127 context : ./view
102128 push : true
129+ platforms : linux/amd64,linux/arm64
103130 tags : ${{ steps.meta-view.outputs.tags }}
104131 labels : ${{ steps.meta-view.outputs.labels }}
105132 build-args : |
106133 NEXT_PUBLIC_PORT=${{ env.NEXT_PUBLIC_PORT }}
107- cache-from : type=local,src=/tmp/.buildx-cache
108- cache-to : type=local,dest=/tmp/.buildx-cache-new
109-
110- - name : Move cache
111- run : |
112- rm -rf /tmp/.buildx-cache
113- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
134+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.VIEW_IMAGE }}:buildcache
135+ cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.VIEW_IMAGE }}:buildcache,mode=max
0 commit comments