Skip to content

Commit

Permalink
👷 Update GitHub Actions to build multiarch
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Mar 17, 2024
1 parent 6354c5f commit a3f2278
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- master
# TODO: remove this
- multiarch
schedule:
# cron every week on monday
- cron: "0 0 * * 1"
Expand All @@ -13,8 +15,6 @@ jobs:
strategy:
matrix:
image:
- name: latest
python_version: "3.11"
- name: python3.11
python_version: "3.11"
- name: python3.10
Expand All @@ -37,22 +37,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
- name: Set up Python
uses: actions/setup-python@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get date for tags
run: echo "DATE_TAG=$(date -I)" >> "$GITHUB_ENV"
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
# TODO: remove debug
tags: |
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}-debug
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}-debug-${{ env.DATE_TAG }}
context: ./docker-images/
file: ./docker-images/${{ matrix.image.name }}.dockerfile
- name: Build and push latest
if: matrix.image.name == 'python3.11'
uses: docker/build-push-action@v2
with:
python-version: "3.7"
- name: Install Dependencies
run: python3.7 -m pip install docker pytest
- name: Deploy Image
run: bash scripts/build-push.sh
env:
NAME: ${{ matrix.image.name }}
PYTHON_VERSION: ${{ matrix.image.python_version }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
push: true
tags: tiangolo/uvicorn-gunicorn:latest-debug
context: ./docker-images/
file: ./docker-images/${{ matrix.image.name }}.dockerfile
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: tiangolo/uvicorn-gunicorn

0 comments on commit a3f2278

Please sign in to comment.