Skip to content

Commit c69a4d5

Browse files
Add build support for arm64 (#740)
* Enable arm64 container built * Enable Dependabot for GHA * Enable workflow_dispatch for github actions * Only login to Docker Hub for upstream repo * Update GHA actions. Simplify docker tag build * Build docker with python 3.11 * DO-NOT-COMMIT: disable uvicorn build * Only tag latest on default branch * Apply suggestions from code review * add TODO --------- Co-authored-by: vincentsarago <[email protected]>
1 parent 1ca50b9 commit c69a4d5

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
jobs:
1313
benchmark:
14+
if: github.repository == 'developmentseed/titiler'
1415
runs-on: ubuntu-latest
1516

1617
steps:

.github/workflows/ci.yml

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
- '.github/codecov.yml'
1717
- 'dockerfiles/**'
1818
pull_request:
19+
workflow_dispatch:
20+
1921
env:
2022
LATEST_PY_VERSION: '3.12'
2123

@@ -120,81 +122,76 @@ jobs:
120122
- name: Set up Docker Buildx
121123
uses: docker/setup-buildx-action@v3
122124

123-
- name: Login to DockerHub
125+
- name: Login to Docker Hub
126+
if: github.repository == 'developmentseed/titiler'
124127
uses: docker/login-action@v3
125128
with:
126129
username: ${{ secrets.DOCKERHUB_USERNAME }}
127130
password: ${{ secrets.DOCKERHUB_TOKEN }}
128131

129-
- name: Login to Github
132+
- name: Log in to the GitHub Container registry
130133
uses: docker/login-action@v3
131134
with:
132135
registry: ghcr.io
133136
username: ${{ github.actor }}
134137
password: ${{ secrets.GITHUB_TOKEN }}
135138

136-
- name: Set tag version
137-
id: tag
138-
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
139-
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
140-
# Uvicorn
141-
# Push `latest` when commiting to main
142-
- name: Build and push uvicorn
143-
if: github.ref == 'refs/heads/main'
144-
uses: docker/build-push-action@v5
139+
- name: Docker meta (unicorn)
140+
id: meta-uvicorn
141+
uses: docker/metadata-action@v5
145142
with:
146-
# See https://github.com/developmentseed/titiler/discussions/387
147-
platforms: linux/amd64
148-
context: .
149-
file: dockerfiles/Dockerfile.uvicorn
150-
push: true
143+
images: |
144+
ghcr.io/${{ github.repository }}-uvicorn
145+
flavor: |
146+
latest=false
151147
tags: |
152-
ghcr.io/${{ github.repository }}-uvicorn:latest
148+
type=semver,pattern={{version}}
149+
type=raw,value=latest,enable={{is_default_branch}}
153150
154-
# Push `{VERSION}` when pushing a new tag
155-
- name: Build and push uvicorn
156-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
157-
uses: docker/build-push-action@v5
151+
- name: Docker meta (gunicorn)
152+
id: meta-gunicorn
153+
uses: docker/metadata-action@v5
158154
with:
159-
# See https://github.com/developmentseed/titiler/discussions/387
160-
platforms: linux/amd64
161-
context: .
162-
file: dockerfiles/Dockerfile.uvicorn
163-
push: true
155+
images: |
156+
ghcr.io/${{ github.repository }}
157+
flavor: |
158+
latest=false
164159
tags: |
165-
ghcr.io/${{ github.repository }}-uvicorn:${{ steps.tag.outputs.tag }}
160+
type=semver,pattern={{version}}
161+
type=raw,value=latest,enable={{is_default_branch}}
166162
167-
# Gunicorn
168-
# Push `latest` when commiting to main
169-
- name: Build and push
170-
if: github.ref == 'refs/heads/main'
163+
# Uvicorn
164+
- name: Build and push uvicorn
171165
uses: docker/build-push-action@v5
172166
with:
173-
# See https://github.com/developmentseed/titiler/discussions/387
174-
platforms: linux/amd64
167+
# TODO: add `linux/arm64 once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
168+
platforms: linux/amd64 # ,linux/arm64
175169
context: .
176-
file: dockerfiles/Dockerfile.gunicorn
177-
push: true
178-
tags: |
179-
ghcr.io/${{ github.repository }}:latest
170+
file: dockerfiles/Dockerfile.uvicorn
171+
push: ${{ github.event_name != 'pull_request' }}
172+
tags: ${{ steps.meta-uvicorn.outputs.tags }}
173+
labels: ${{ steps.meta-uvicorn.outputs.labels }}
174+
cache-from: type=gha
175+
cache-to: type=gha,mode=max
180176

181-
# Push `{VERSION}` when pushing a new tag
177+
# Gunicorn
182178
- name: Build and push
183-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
184179
uses: docker/build-push-action@v5
185180
with:
186-
# See https://github.com/developmentseed/titiler/discussions/387
187-
platforms: linux/amd64
181+
# TODO: add `linux/arm64 once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
182+
platforms: linux/amd64 # ,linux/arm64
188183
context: .
189184
file: dockerfiles/Dockerfile.gunicorn
190-
push: true
191-
tags: |
192-
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.tag }}
185+
push: ${{ github.event_name != 'pull_request' }}
186+
tags: ${{ steps.meta-gunicorn.outputs.tags }}
187+
labels: ${{ steps.meta-gunicorn.outputs.labels }}
188+
cache-from: type=gha
189+
cache-to: type=gha,mode=max
193190

194191
deploy:
195192
needs: [tests, publish]
196193
runs-on: ubuntu-latest
197-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
194+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' && github.repository == 'developmentseed/titiler'
198195

199196
defaults:
200197
run:

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '3'
22

33
services:
44
titiler:
5+
# TODO: remove once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
56
# See https://github.com/developmentseed/titiler/discussions/387
67
platform: linux/amd64
78
build:
@@ -47,6 +48,7 @@ services:
4748
# - RIO_TILER_MAX_THREADS=
4849

4950
titiler-uvicorn:
51+
# TODO: remove once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
5052
# See https://github.com/developmentseed/titiler/discussions/387
5153
platform: linux/amd64
5254
build:

0 commit comments

Comments
 (0)