-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Build multi-arch images for commits on main #7900
Changes from 4 commits
2db6388
157dd9b
54c8469
fff5b5b
d6defda
976f9bc
9b29971
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
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 | ||
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 }} | ||
|
||
zanieb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This reminds me of the issue with retagging images build from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we solved this problem with a mount directive: https://github.com/pypa/setuptools_scm#usage-from-docker There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. although that does void all subsequent layer caches, so we have to do it as late as possible 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm we just copy the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah gotcha. yes copying they do however provide a 'pretend' environment variable mechanic you could combine with |
||
|
||
- 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 | ||
zanieb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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' ) || '' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you'll need "environment: dev" like we do for the prod environment https://github.com/PrefectHQ/prefect/blob/main/.github/workflows/release.yaml#L186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! d6defda