13
13
GH_TOKEN : ${{ secrets.GH_TOKEN }}
14
14
15
15
jobs :
16
- pi-build :
17
- name : ' Parent Images: Build Requirements'
16
+ pi-compile :
17
+ name : ' Parent Images: Compile Requirements'
18
18
runs-on : ubuntu-latest
19
19
env :
20
20
PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
21
+ outputs :
22
+ updated_parent_types : ${{ steps.run-build.outputs.updated_parent_types }}
21
23
steps :
22
24
- name : Checkout repository
23
25
uses : actions/checkout@v4
24
- with :
25
- ref : ${{ github.sha }}
26
- fetch-depth : 0
27
26
28
27
- name : GitHub Configuration
29
28
run : git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
30
29
31
30
- name : Clone cicd-deployment-scripts
32
31
run : git clone --branch parent-images https://github.com/code-kern-ai/cicd-deployment-scripts.git
33
-
32
+
34
33
- name : Set up Python
35
34
uses : actions/setup-python@v5
36
35
with :
37
36
python-version : ${{ env.PYTHON_VERSION }}
38
-
37
+
39
38
- name : Install dependencies
40
39
run : python -m pip install pip-tools
41
-
40
+
42
41
- name : Run build
42
+ id : run-build
43
43
run : |
44
44
bash cicd-deployment-scripts/pi/build.sh \
45
- -p "${{ github.event.pull_request.number }}"
45
+ -p "${{ github.event.pull_request.number }}"
46
+
47
+ pi-build :
48
+ name : ' Parent Images: Build'
49
+ runs-on : ubuntu-latest
50
+ needs : pi-compile
51
+ env :
52
+ PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
53
+ DEV_CONTAINER_REGISTRY : ${{ vars.DEV_CONTAINER_REGISTRY }}
54
+ DEV_LOGIN_USERNAME : ${{ secrets.DEV_LOGIN_USERNAME }}
55
+ DEV_LOGIN_PASSWORD : ${{ secrets.DEV_LOGIN_PASSWORD }}
56
+ DOCKERHUB_CONTAINER_REGISTRY : ${{ vars.DOCKERHUB_CONTAINER_REGISTRY }}
57
+ DOCKERHUB_LOGIN_USERNAME : ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}
58
+ DOCKERHUB_LOGIN_PASSWORD : ${{ secrets.DOCKERHUB_LOGIN_PASSWORD }}
59
+ IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
60
+ strategy :
61
+ matrix :
62
+ parent_image_type : ${{ toJson(needs.pi-compile.outputs.updated_parent_types) }}
63
+ steps :
64
+ - name : Dump needs context
65
+ env :
66
+ NEEDS_CONTEXT : ${{ toJson(needs) }}
67
+ run : echo "$NEEDS_CONTEXT"
68
+
69
+ - name : Checkout repository
70
+ uses : actions/checkout@v4
71
+ with :
72
+ repository : ' ${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image'
73
+ submodules : ' true'
74
+
75
+ - name : Set up Docker Buildx
76
+ uses : docker/setup-buildx-action@v3
77
+ with :
78
+ platforms : linux/amd64,linux/arm64
79
+
80
+ - name : Set up QEMU
81
+ uses : docker/setup-qemu-action@v3
82
+ with :
83
+ platforms : arm64,arm
84
+
85
+ - name : Log into DEV registry
86
+ uses : docker/login-action@v3
87
+ with :
88
+ registry : " ${{ env.DEV_CONTAINER_REGISTRY }}"
89
+ username : " ${{ env.DEV_LOGIN_USERNAME }}"
90
+ password : " ${{ env.DEV_LOGIN_PASSWORD }}"
91
+
92
+ - name : Log into Docker Hub registry
93
+ uses : docker/login-action@v3
94
+ with :
95
+ username : " ${{ env.DOCKERHUB_LOGIN_USERNAME }}"
96
+ password : " ${{ env.DOCKERHUB_LOGIN_PASSWORD }}"
97
+
98
+ - name : Build & Push refinery-${{ matrix.parent_image_type }}-parent-image:amd64
99
+ if : ${{ github.event_name != 'release' }}
100
+ uses : docker/build-push-action@v5
101
+ with :
102
+ cache-from : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-image:dev-${{ matrix.parent_image_type }}-cache
103
+ cache-to : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-image:dev-${{ matrix.parent_image_type }}-cache,mode=max,image-manifest=true
104
+ platforms : linux/amd64
105
+ file : Dockerfile
106
+ tags : ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-image:dev-${{ matrix.parent_image_type }}
107
+ push : true
108
+ build-args : |
109
+ platform=linux/amd64
110
+ label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
0 commit comments