-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build multi-arch images for commits on main (#7900)
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Build prefect docker images | ||
|
||
# Note: Conda support for 3.11 is pending. See https://github.com/ContinuumIO/anaconda-issues/issues/13082 | ||
|
||
on: | ||
# On each commit merged into main, push sha and branch patterns | ||
push: | ||
branches: main | ||
# On workflow_dispatch, push sha and branch patterns | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-docker-images: | ||
name: Build Docker images | ||
runs-on: ubuntu-latest | ||
environment: ${{ ( github.event_name == 'release' && 'prod' ) || 'dev' }} | ||
strategy: | ||
matrix: | ||
flavor: | ||
- "" | ||
- "-conda" | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
exclude: | ||
# Not yet supported, see note at top | ||
- flavor: "-conda" | ||
python-version: "3.11" | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate image metadata | ||
id: metadata | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: prefecthq/prefect-dev | ||
tags: | | ||
type=raw,enable=${{ github.event_name != 'release' }},value=${{ github.ref_name }},suffix=-python${{ matrix.python-version }} | ||
type=sha,suffix=-python${{ matrix.python-version }} | ||
flavor: | | ||
latest=false | ||
suffix=${{ matrix.flavor }} | ||
- name: Build image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
build-args: | | ||
PYTHON_VERSION=${{ matrix.python-version }} | ||
${{ ( endsWith(matrix.flavor, 'conda') && 'BASE_IMAGE=prefect-conda' ) || '' }} | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.labels }} | ||
push: true | ||
# multi-stage cache manifests (mode=max) need a separate tag because they are not usable for runtime ref https://github.com/moby/buildkit#export-cache | ||
cache-from: type=registry,ref=prefecthq/prefect-dev:buildcache-python${{ matrix.python-version }}${{ matrix.flavor }} | ||
cache-to: ${{ ( github.event_name == 'push' && 'type=registry,ref=prefecthq/prefect-dev:buildcache-python${{ matrix.python-version }}${{ matrix.flavor }},mode=max' ) || '' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters