2121
2222jobs :
2323 build :
24- runs-on : ubuntu-latest
2524 if : " !contains(github.event.head_commit.message, '[skip ci]')"
25+ strategy :
26+ matrix :
27+ arch : [amd64, arm64]
28+ include :
29+ - arch : amd64
30+ runner : ubuntu-24.04
31+ - arch : arm64
32+ runner : ubuntu-24.04-arm
33+ runs-on : ${{ matrix.runner }}
2634 steps :
2735 - uses : actions/checkout@v6
2836
@@ -49,37 +57,39 @@ jobs:
4957 - name : Build
5058 uses : docker/build-push-action@v6
5159 with :
52- platforms : linux/amd64
60+ platforms : linux/${{ matrix.arch }}
5361 context : .
5462 load : true
5563 file : dockerfiles/Dockerfile
5664 build-args : |
5765 GDAL_VERSION=${{ env.GDAL_VERSION }}
58- tags : ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}
59- cache-from : type=gha
60- cache-to : type=gha,mode=max
66+ tags : ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
67+ cache-from : type=gha,scope=${{ matrix.arch }}
68+ cache-to : type=gha,mode=max,scope=${{ matrix.arch }}
6169
6270 - name : Test
6371 run : |
6472 docker run \
65- --platform=linux/amd64 \
6673 --entrypoint bash \
6774 -v ${{ github.workspace }}:/local \
68- --rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
75+ --rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
6976 /local/tests/tests.sh
7077
71- deploy :
78+ deploy-gdal :
7279 needs : [build]
73- runs-on : ubuntu-latest
7480 if : contains(github.ref, 'tags') && github.event_name == 'push'
81+ strategy :
82+ matrix :
83+ arch : [amd64, arm64]
84+ include :
85+ - arch : amd64
86+ runner : ubuntu-24.04
87+ - arch : arm64
88+ runner : ubuntu-24.04-arm
89+ runs-on : ${{ matrix.runner }}
7590 steps :
7691 - uses : actions/checkout@v6
7792
78- - name : Set up Python
79- uses : actions/setup-python@v6
80- with :
81- python-version : ' 3.13'
82-
8393 - name : Set up Docker Buildx
8494 uses : docker/setup-buildx-action@v3
8595
@@ -90,54 +100,144 @@ jobs:
90100 username : ${{ github.repository_owner }}
91101 password : ${{ secrets.GITHUB_TOKEN }}
92102
93- - name : Configure AWS Credentials
94- uses : aws-actions/configure-aws-credentials@v6
95- with :
96- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
97- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
98- aws-region : us-east-1
99-
100- - name : Publish docker image
103+ - name : Publish docker image (${{ matrix.arch }})
101104 uses : docker/build-push-action@v6
102105 with :
103- platforms : linux/amd64
106+ platforms : linux/${{ matrix.arch }}
104107 context : .
105108 file : dockerfiles/Dockerfile
106109 build-args : |
107110 GDAL_VERSION=${{ env.GDAL_VERSION }}
108111 push : true
109- cache-from : type=gha
110- tags : ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}
112+ cache-from : type=gha,scope=${{ matrix.arch }}
113+ cache-to : type=gha,mode=max,scope=${{ matrix.arch }}
114+ tags : ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
115+
116+ deploy-gdal-manifest :
117+ needs : [deploy-gdal]
118+ runs-on : ubuntu-24.04
119+ if : contains(github.ref, 'tags') && github.event_name == 'push'
120+ steps :
121+ - name : Login to Github
122+ uses : docker/login-action@v3
123+ with :
124+ registry : ghcr.io
125+ username : ${{ github.repository_owner }}
126+ password : ${{ secrets.GITHUB_TOKEN }}
127+
128+ - name : Create multi-arch manifest
129+ run : |
130+ docker buildx imagetools create \
131+ -t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
132+ ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-amd64 \
133+ ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-arm64
134+
135+ deploy-layers :
136+ needs : [deploy-gdal]
137+ if : contains(github.ref, 'tags') && github.event_name == 'push'
138+ strategy :
139+ matrix :
140+ include :
141+ - arch : amd64
142+ lambda_arch : x86_64
143+ runner : ubuntu-24.04
144+ - arch : arm64
145+ lambda_arch : arm64
146+ runner : ubuntu-24.04-arm
147+ runs-on : ${{ matrix.runner }}
148+ steps :
149+ - uses : actions/checkout@v6
150+
151+ - name : Set up Python
152+ uses : actions/setup-python@v6
153+ with :
154+ python-version : ' 3.13'
155+
156+ - name : Configure AWS Credentials
157+ uses : aws-actions/configure-aws-credentials@v6
158+ with :
159+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
160+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
161+ aws-region : us-east-1
111162
112- - name : Build and Deploy layers
163+ - name : Build and Deploy layer (${{ matrix.arch }})
113164 run : |
114165 python -m pip install boto3 click
115166 docker run \
116- --platform=linux/amd64 \
117167 --entrypoint bash \
168+ -e OUTPUT_ZIP=package-${{ matrix.arch }}.zip \
118169 -v ${{ github.workspace }}:/local \
119- --rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
170+ --rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
120171 /local/scripts/create-layer.sh
121- python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --deploy
172+ python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --arch ${{ matrix.lambda_arch }} --package package-${{ matrix.arch }}.zip --deploy
173+
174+ deploy-runtime :
175+ needs : [deploy-gdal]
176+ if : contains(github.ref, 'tags') && github.event_name == 'push'
177+ strategy :
178+ matrix :
179+ runtime : ['3.12', '3.13']
180+ arch : [amd64, arm64]
181+ include :
182+ - arch : amd64
183+ runner : ubuntu-24.04
184+ - arch : arm64
185+ runner : ubuntu-24.04-arm
186+ runs-on : ${{ matrix.runner }}
187+ steps :
188+ - uses : actions/checkout@v6
189+
190+ - name : Set up Docker Buildx
191+ uses : docker/setup-buildx-action@v3
192+
193+ - name : Login to Github
194+ uses : docker/login-action@v3
195+ with :
196+ registry : ghcr.io
197+ username : ${{ github.repository_owner }}
198+ password : ${{ secrets.GITHUB_TOKEN }}
199+
200+ - name : Build and push runtime image (python${{ matrix.runtime }}, ${{ matrix.arch }})
201+ uses : docker/build-push-action@v6
202+ with :
203+ platforms : linux/${{ matrix.arch }}
204+ context : .
205+ file : dockerfiles/runtimes/python
206+ build-args : |
207+ GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
208+ RUNTIME_VERSION=${{ matrix.runtime }}
209+ NUMPY_VERSION=2.4.2
210+ PKG_INSTALLER=dnf
211+ push : true
212+ cache-from : type=gha,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
213+ cache-to : type=gha,mode=max,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
214+ tags : ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-${{ matrix.arch }}
215+
216+ deploy-runtime-manifest :
217+ needs : [deploy-runtime]
218+ runs-on : ubuntu-24.04
219+ if : contains(github.ref, 'tags') && github.event_name == 'push'
220+ strategy :
221+ matrix :
222+ runtime : ['3.12', '3.13']
223+ steps :
224+ - name : Login to Github
225+ uses : docker/login-action@v3
226+ with :
227+ registry : ghcr.io
228+ username : ${{ github.repository_owner }}
229+ password : ${{ secrets.GITHUB_TOKEN }}
122230
123- - name : Build Runtime and Push Python >= 3.12 with dnf
231+ - name : Create multi-arch manifest (python${{ matrix.runtime }})
124232 run : |
125- runtimes='3.12 3.13'
126- for runtime in ${runtimes}; do
127- docker build \
128- --platform=linux/amd64 \
129- --build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }} \
130- --build-arg RUNTIME_VERSION=${runtime} \
131- --build-arg NUMPY_VERSION=2.4.2 \
132- --build-arg PKG_INSTALLER=dnf \
133- -f dockerfiles/runtimes/python \
134- -t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} .
135- docker push ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime}
136- done
233+ docker buildx imagetools create \
234+ -t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }} \
235+ ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-amd64 \
236+ ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-arm64
137237
138238 update-layer :
139- needs : [deploy]
140- runs-on : ubuntu-latest
239+ needs : [deploy-layers ]
240+ runs-on : ubuntu-24.04
141241 steps :
142242 - uses : actions/checkout@v6
143243
0 commit comments