Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build support for arm64 #740

Merged
merged 12 commits into from
May 7, 2024
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
benchmark:
if: github.repository == 'developmentseed/titiler'
runs-on: ubuntu-latest

steps:
Expand Down
87 changes: 42 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
- '.github/codecov.yml'
- 'dockerfiles/**'
pull_request:
workflow_dispatch:

env:
LATEST_PY_VERSION: '3.12'

Expand Down Expand Up @@ -120,81 +122,76 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
- name: Login to Docker Hub
if: github.repository == 'developmentseed/titiler'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Github
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set tag version
id: tag
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
# Uvicorn
# Push `latest` when commiting to main
- name: Build and push uvicorn
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
- name: Docker meta (unicorn)
id: meta-uvicorn
uses: docker/metadata-action@v5
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.uvicorn
push: true
images: |
ghcr.io/${{ github.repository }}-uvicorn
flavor: |
latest=false
tags: |
ghcr.io/${{ github.repository }}-uvicorn:latest
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}

# Push `{VERSION}` when pushing a new tag
- name: Build and push uvicorn
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v5
- name: Docker meta (gunicorn)
id: meta-gunicorn
uses: docker/metadata-action@v5
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.uvicorn
push: true
images: |
ghcr.io/${{ github.repository }}
flavor: |
latest=false
tags: |
ghcr.io/${{ github.repository }}-uvicorn:${{ steps.tag.outputs.tag }}
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}

# Gunicorn
# Push `latest` when commiting to main
- name: Build and push
if: github.ref == 'refs/heads/main'
# Uvicorn
- name: Build and push uvicorn
uses: docker/build-push-action@v5
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
# TODO: add `linux/arm64 once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
platforms: linux/amd64 # ,linux/arm64
context: .
file: dockerfiles/Dockerfile.gunicorn
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
file: dockerfiles/Dockerfile.uvicorn
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-uvicorn.outputs.tags }}
labels: ${{ steps.meta-uvicorn.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

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

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

defaults:
run:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3'

services:
titiler:
# TODO: remove once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
# See https://github.com/developmentseed/titiler/discussions/387
platform: linux/amd64
build:
Expand Down Expand Up @@ -47,6 +48,7 @@ services:
# - RIO_TILER_MAX_THREADS=

titiler-uvicorn:
# TODO: remove once https://github.com/rasterio/rasterio-wheels/issues/69 is resolved
# See https://github.com/developmentseed/titiler/discussions/387
platform: linux/amd64
build:
Expand Down