Skip to content

Commit

Permalink
Use docker/build-push-action to build images (#1672)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <pingsutw@apache.org>
  • Loading branch information
pingsutw committed May 10, 2024
1 parent acab1b7 commit 8495dea
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,37 @@ jobs:
pip install uv
uv venv
source .venv/bin/activate
uv pip install flytekit flytekitplugins-envd
if [ -f requirements.in ]; then uv pip install -r requirements.in; fi
uv pip install "flytekit>=1.12.1b0" flytekitplugins-envd
pip freeze
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.FLYTE_BOT_USERNAME }}
password: ${{ secrets.FLYTE_BOT_PAT }}
- name: Build and push default image
- name: Check if dockerfile exists
working-directory: examples/${{ matrix.example }}
id: dockerfile
run: |
if [ -f Dockerfile ]; then
tag1=ghcr.io/flyteorg/flytecookbook:${{ matrix.example }}-${{ github.sha }}
tag2=ghcr.io/flyteorg/flytecookbook:latest
docker build -t "$tag1" -t "$tag2" .
if ${{ github.event_name != 'pull_request' }}; then
docker push ghcr.io/flyteorg/flytecookbook --all-tags
fi
if [ -f Dockerfile ]
then
echo "exist=true" >> "$GITHUB_OUTPUT"
else
echo "exist=false" >> "$GITHUB_OUTPUT"
fi
- name: Build and push default image
if: ${{ steps.dockerfile.outputs.exist == true }}
uses: docker/build-push-action@v5
with:
context: examples/${{ matrix.example }}
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/flyteorg/flytecookbook:${{ matrix.example }}-${{ github.sha }},ghcr.io/flyteorg/flytecookbook:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Pyflyte package
working-directory: examples/${{ matrix.example }}
run: |
Expand Down Expand Up @@ -287,7 +298,7 @@ jobs:
pip install uv
uv venv
source .venv/bin/activate
uv pip install --upgrade pip flytekit flytekitplugins-deck-standard torch
uv pip install "flytekit>=1.12.1b0" flytekitplugins-deck-standard torch tabulate
pip freeze
- name: Checkout flytesnacks
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions examples/development_lifecycle/development_lifecycle/decks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import flytekit
from flytekit import ImageSpec, task
from flytekitplugins.deck.renderer import MarkdownRenderer
from flytekit.deck.renderer import MarkdownRenderer
from sklearn.decomposition import PCA

# Create a new deck named `pca` and render Markdown content along with a
Expand Down Expand Up @@ -127,7 +127,7 @@ def table_renderer() -> None:
# and renders it as a Unicode string on the deck.
import inspect

from flytekitplugins.deck.renderer import SourceCodeRenderer
from flytekit.deck.renderer import SourceCodeRenderer


@task(enable_deck=True)
Expand Down
1 change: 1 addition & 0 deletions examples/development_lifecycle/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ flytekitplugins-deck-standard
flytekitplugins-envd
plotly
scikit-learn
tabulate
3 changes: 2 additions & 1 deletion examples/nlp_processing/requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flytekit>=0.32.3
flytekit
wheel
matplotlib
flytekitplugins-deck-standard
Expand All @@ -8,3 +8,4 @@ nltk
plotly
pyemd
scikit-learn
scipy==1.10.1
1 change: 1 addition & 0 deletions examples/snowflake_agent/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flytekitplugins-snowflake==1.7.0
flytekitplugins-envd==1.7.0
flytekit==1.7.1b1
marshmallow_enum
1 change: 1 addition & 0 deletions examples/snowflake_plugin/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flytekitplugins-snowflake==1.7.0
flytekit==1.7.1b1
flytekitplugins-envd==1.7.0
marshmallow_enum
2 changes: 1 addition & 1 deletion examples/whylogs_plugin/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ matplotlib
flytekitplugins-deck-standard
flytekitplugins-whylogs>=1.1.1b0
scikit-learn
whylogs[s3]
whylogs[s3]==1.3.30
whylogs[mlflow]
whylogs[whylabs]

0 comments on commit 8495dea

Please sign in to comment.