From 8495dea1f68d3370ae640f3d159fb3530adaedd9 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Sat, 11 May 2024 00:55:46 +0800 Subject: [PATCH] Use docker/build-push-action to build images (#1672) Signed-off-by: Kevin Su --- .github/workflows/checks.yml | 31 +++++++++++++------ .../development_lifecycle/decks.py | 4 +-- .../development_lifecycle/requirements.in | 1 + examples/nlp_processing/requirements.in | 3 +- examples/snowflake_agent/requirements.in | 1 + examples/snowflake_plugin/requirements.in | 1 + examples/whylogs_plugin/requirements.in | 2 +- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 812858bd0..11a46b473 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -90,8 +90,11 @@ 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 @@ -99,17 +102,25 @@ jobs: 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: | @@ -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 diff --git a/examples/development_lifecycle/development_lifecycle/decks.py b/examples/development_lifecycle/development_lifecycle/decks.py index 9a69ee7be..d0e48afc1 100644 --- a/examples/development_lifecycle/development_lifecycle/decks.py +++ b/examples/development_lifecycle/development_lifecycle/decks.py @@ -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 @@ -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) diff --git a/examples/development_lifecycle/requirements.in b/examples/development_lifecycle/requirements.in index c9db52868..2277c48c2 100644 --- a/examples/development_lifecycle/requirements.in +++ b/examples/development_lifecycle/requirements.in @@ -3,3 +3,4 @@ flytekitplugins-deck-standard flytekitplugins-envd plotly scikit-learn +tabulate diff --git a/examples/nlp_processing/requirements.in b/examples/nlp_processing/requirements.in index a040dab33..70cd2c302 100644 --- a/examples/nlp_processing/requirements.in +++ b/examples/nlp_processing/requirements.in @@ -1,4 +1,4 @@ -flytekit>=0.32.3 +flytekit wheel matplotlib flytekitplugins-deck-standard @@ -8,3 +8,4 @@ nltk plotly pyemd scikit-learn +scipy==1.10.1 diff --git a/examples/snowflake_agent/requirements.in b/examples/snowflake_agent/requirements.in index 4c334f36d..72cfd9946 100644 --- a/examples/snowflake_agent/requirements.in +++ b/examples/snowflake_agent/requirements.in @@ -1,3 +1,4 @@ flytekitplugins-snowflake==1.7.0 flytekitplugins-envd==1.7.0 flytekit==1.7.1b1 +marshmallow_enum diff --git a/examples/snowflake_plugin/requirements.in b/examples/snowflake_plugin/requirements.in index b804a06af..733829480 100644 --- a/examples/snowflake_plugin/requirements.in +++ b/examples/snowflake_plugin/requirements.in @@ -1,3 +1,4 @@ flytekitplugins-snowflake==1.7.0 flytekit==1.7.1b1 flytekitplugins-envd==1.7.0 +marshmallow_enum diff --git a/examples/whylogs_plugin/requirements.in b/examples/whylogs_plugin/requirements.in index 3f8bc07aa..0091e81e3 100644 --- a/examples/whylogs_plugin/requirements.in +++ b/examples/whylogs_plugin/requirements.in @@ -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]