Repository: PrefectHQ/prefect
Pull request: Adds `prefect-client` images to the release and pre-release builds
Closes #17599

<!--
Thanks for opening a pull request to Prefect!
If this is your first contribution, please make sure to review our contribution guidelines: https://docs.prefect.io/contribute/index
-->

<!-- Include an overview of the proposed changes here -->

### Checklist
<!-- These boxes may be checked after opening the pull request. -->

- [x] This pull request references any related issue by including "closes `<link to issue>`"
  - If no issue exists and your change is not a small fix, please [create an issue](https://github.com/PrefectHQ/prefect/issues/new/choose) first.
- [x] If this pull request adds new functionality, it includes unit tests that cover the changes
- [x] If this pull request removes docs files, it includes redirect settings in `mint.json`.
- [x] If this pull request adds functions or classes, it includes helpful docstrings.


Problem statement:
Publish a `prefecthq/prefect-client` image based on the `prefect-client` Python package
### Describe the current behavior

The current image is ~770MB and includes everything you'd need to run workers and a permanent Prefect server.

### Describe the proposed behavior

With a build just based on `prefect-client`, we can get down to ~310MB

### Example Use

The goal here would be an image that's a drop-in replacement for `prefecthq/prefect:3-...` for running flows against remote servers.

### Additional context

_No response_

Hints from issue discussion:

Commit message: Adds `prefect-client` images to the release and pre-release builds

Closes #17599

Patch to review:
diff --git a/.github/workflows/docker-images.yaml b/.github/workflows/docker-images.yaml
index 6ef293ceef11..dccf604501f8 100644
--- a/.github/workflows/docker-images.yaml
+++ b/.github/workflows/docker-images.yaml
@@ -22,19 +22,29 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        flavor:
-          - ""
-          - "-conda"
-          - "-kubernetes"
+        image:
+          - "prefecthq/prefect"
+          - "prefecthq/prefect-client"
+        release:
+          - true
+          - false
         python-version:
           - "3.9"
           - "3.10"
           - "3.11"
           - "3.12"
+        flavor:
+        - ""
+        include:
+        # Add conda and kubernetes flavors only for prefect images
+        - image: "prefect"
+          flavor: "-conda"
+        - image: "prefect"
+          flavor: "-kubernetes"
 
     steps:
       - name: Validate Prerelease Tag
-        if: ${{ github.event_name == 'release' && github.event.release.prerelease == true }}
+        if: ${{ !matrix.release && github.event_name == 'release' && github.event.release.prerelease == true }}
         run: |
           TAG_NAME=${{ github.ref }}
           if [[ ! "$TAG_NAME" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9]+|\.dev[0-9]+)$ ]]; then
@@ -60,13 +70,13 @@ jobs:
         with:
           fetch-depth: 0
 
-      - name: Generate tags for prefecthq/prefect-dev
+      - name: Generate tags for ${{ matrix.image }}-dev
         id: metadata-dev
         uses: docker/metadata-action@v5
         # do not generate the development tags on true release events, only pre-releases
-        if: ${{ github.event_name == 'release' && github.event.release.prerelease == true }}
+        if: ${{ !matrix.release && github.event_name == 'release' && github.event.release.prerelease == true }}
         with:
-          images: prefecthq/prefect-dev
+          images: ${{ matrix.image }}-dev
           tags: |
             type=raw,value=${{ github.ref_name }},suffix=-python${{ matrix.python-version }}${{ matrix.flavor }}
             type=sha,suffix=-python${{ matrix.python-version }}${{ matrix.flavor }}
@@ -83,13 +93,13 @@ jobs:
             "${{ github.api_url }}/repos/${{ github.repository }}/releases/latest" \
           | jq -r .tag_name)" >> $GITHUB_ENV
 
-      - name: Generate tags for prefecthq/prefect
+      - name: Generate tags for ${{ matrix.image }}
         id: metadata-prod
         uses: docker/metadata-action@v5
         # generate the production tags on release events or when manually triggered for 3-latest
-        if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_3_latest == 'true') }}
+        if: ${{ matrix.release && (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_3_latest == 'true')) }}
         with:
-          images: prefecthq/prefect
+          images: ${{ matrix.image }}
           # push `latest`, `X.Y` and `X` tags only when the release is not marked as prerelease
           # push `latest` and `X` tags only when the release is marked as latest
           # push `3-latest` tags on latest release or manual trigger


Code review comments:
diff_hunk: @@ -22,19 +22,29 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        flavor:
-          - ""
-          - "-conda"
-          - "-kubernetes"
+        image:
+          - "prefecthq/prefect"
+          - "prefecthq/prefect-client"
+        release:
+          - true
+          - false
path: .github/workflows/docker-images.yaml
text: @user1:
Why did you add this? We determine which images to push based on how the pipeline was triggered, so I'm not sure this is necessary.

@author:
Ahh, okay that was from how I thought the matrix worked, but you pointed me in the right direction with `exclude` and I think you're right, we don't need that.