1+ name : BuildDockerDeeploy
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ docker_image_toolchain :
7+ description : ' Deeploy Toolchain Image to use'
8+ required : false
9+ default : ' ghcr.io/pulp-platform/deeploy-toolchain:latest'
10+
11+ jobs :
12+ prepare :
13+ name : Fetch branch name or tag
14+ runs-on : ubuntu-latest
15+ outputs :
16+ docker_tag : ${{ steps.generate_tag.outputs.docker_tag }}
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Set up environment variables
21+ run : |
22+ echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
23+ echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
24+ echo "IS_TAG=${GITHUB_REF_TYPE}" >> $GITHUB_ENV
25+
26+ - name : Set Docker tag
27+ id : generate_tag
28+ run : |
29+ if [[ "${{ env.IS_TAG }}" == "tag" ]]; then
30+ echo "docker_tag=${{ env.TAG_NAME }}" >> $GITHUB_OUTPUT
31+ else
32+ echo "docker_tag=${{ env.BRANCH_NAME }}" >> $GITHUB_OUTPUT
33+ fi
34+
35+ build-deeploy :
36+ name : Build Deploy Image
37+ needs : [ prepare ]
38+ runs-on : ${{ matrix.runner }}
39+ strategy :
40+ fail-fast : false
41+ matrix :
42+ platform : [amd64, arm64]
43+ include :
44+ - platform : amd64
45+ runner : ubuntu-latest
46+ - platform : arm64
47+ runner : ubuntu-22.04-arm
48+ steps :
49+ - uses : actions/checkout@v4
50+
51+ - name : Free up disk space
52+ uses : jlumbroso/free-disk-space@v1.3.1
53+ with :
54+ android : true
55+ dotnet : true
56+ haskell : true
57+ large-packages : true
58+
59+ - uses : docker/setup-buildx-action@v1
60+
61+ - name : GHCR Log-in
62+ uses : docker/login-action@v1
63+ with :
64+ registry : ghcr.io
65+ username : ${{ github.actor }}
66+ password : ${{ secrets.GITHUB_TOKEN }}
67+
68+ - name : Build Cache for Docker
69+ uses : actions/cache@v3
70+ with :
71+ path : var-ccache
72+ key : ${{ runner.os }}-${{ matrix.platform }}-build-cache-deeploy
73+
74+ - name : Inject build-cache
75+ uses : reproducible-containers/buildkit-cache-dance@v3.1.0
76+ with :
77+ cache-map : |
78+ {
79+ "var-ccache": "/ccache"
80+ }
81+ skip-extraction : ${{ steps.cache.outputs.cache-hit }}
82+
83+ - name : Lower Case Repository Name
84+ run : |
85+ echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
86+ env :
87+ OWNER : ' ${{ github.repository_owner }}'
88+
89+ - name : Build and push final deploy image
90+ uses : docker/build-push-action@v6
91+ with :
92+ platforms : linux/${{ matrix.platform }}
93+ context : .
94+ cache-from : type=gha
95+ cache-to : type=gha,mode=min
96+ file : Container/Dockerfile.deeploy
97+ push : true
98+ build-args : |
99+ BASE_IMAGE=${{ github.event.inputs.docker_image_toolchain }}
100+ tags : |
101+ ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-${{ matrix.platform }}
102+ ghcr.io/${{ env.OWNER_LC }}/deeploy:${{ needs.prepare.outputs.docker_tag }}-${{ matrix.platform }}
103+
104+ merge-deeploy-images :
105+ name : Merge Deeploy Images
106+ runs-on : ubuntu-latest
107+ needs : [ prepare, build-deeploy ]
108+ steps :
109+ - name : GHCR Log-in
110+ uses : docker/login-action@v1
111+ with :
112+ registry : ghcr.io
113+ username : ${{ github.actor }}
114+ password : ${{ secrets.GITHUB_TOKEN }}
115+
116+ - name : Lower Case Repository Name
117+ run : |
118+ echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
119+ env :
120+ OWNER : ' ${{ github.repository_owner }}'
121+
122+ - uses : Noelware/docker-manifest-action@v1
123+ with :
124+ inputs : ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-amd64,ghcr.io/${{ env.OWNER_LC }}/deeploy:latest-arm64
125+ tags : ghcr.io/${{ env.OWNER_LC }}/deeploy:latest,ghcr.io/${{ env.OWNER_LC }}/deeploy:${{ needs.prepare.outputs.docker_tag }}
126+ push : true
0 commit comments