From ff52b47e9c27c7aa675f25f4792bbd2878d78fa6 Mon Sep 17 00:00:00 2001 From: Robert Steiner Date: Wed, 6 Dec 2023 15:21:36 +0100 Subject: [PATCH] update server image build workflow --- .github/workflows/_docker-build.yml | 12 ++++++------ .github/workflows/docker-base.yml | 9 +++++---- .github/workflows/docker-server.yml | 4 ++-- src/docker/server/Dockerfile | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/_docker-build.yml b/.github/workflows/_docker-build.yml index 817ce348705d..4b7c17206664 100644 --- a/.github/workflows/_docker-build.yml +++ b/.github/workflows/_docker-build.yml @@ -3,7 +3,7 @@ name: Reusable docker server image build workflow on: workflow_call: inputs: - namespace_repository: + namespace-repository: description: "The namespace and repository in the following format `namespace/repository` e.g. (flwr/base)." required: true type: string @@ -58,7 +58,7 @@ jobs: id: meta uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0 with: - images: ${{ inputs.namespace_repository }} + images: ${{ inputs.namespace-repository }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 @@ -76,7 +76,7 @@ jobs: platforms: ${{ matrix.platform.docker }} context: "{{defaultContext}}:${{ inputs.file }}" build-args: ${{ inputs.build-args }} - outputs: type=image,name=${{ inputs.namespace_repository }},push-by-digest=true,name-canonical=true,push=true + outputs: type=image,name=${{ inputs.namespace-repository }},push-by-digest=true,name-canonical=true,push=true - name: Export digest run: | @@ -110,7 +110,7 @@ jobs: id: meta uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0 with: - images: ${{ inputs.namespace_repository }} + images: ${{ inputs.namespace-repository }} tags: ${{ inputs.tags }} - name: Set up Docker Buildx @@ -126,6 +126,6 @@ jobs: working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ inputs.namespace_repository }}@sha256:%s ' *) + $(printf '${{ inputs.namespace-repository }}@sha256:%s ' *) - name: Inspect image - run: docker buildx imagetools inspect ${{ inputs.namespace_repository }}:${{ steps.meta.outputs.version }} + run: docker buildx imagetools inspect ${{ inputs.namespace-repository }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/docker-base.yml b/.github/workflows/docker-base.yml index bddc70385212..1b01350e751c 100644 --- a/.github/workflows/docker-base.yml +++ b/.github/workflows/docker-base.yml @@ -1,9 +1,10 @@ name: Build docker base image on: - push: - # paths: - # - src/docker/base + workflow_dispatch + # push: + # paths: + # - src/docker/base/* permissions: contents: read @@ -40,7 +41,7 @@ jobs: matrix: python-version: [3.11] with: - namespace_repository: flwr/base + namespace-repository: flwr/base file: src/docker/base build-args: | PYTHON_VERSION=${{ matrix.python-version }} diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml index 3e351c6e9b43..4f4eecb30b73 100644 --- a/.github/workflows/docker-server.yml +++ b/.github/workflows/docker-server.yml @@ -11,7 +11,7 @@ on: description: "Version of Flower base image." required: false type: string - default: "22.04" + default: "py3.11-ubuntu22.04" permissions: contents: read @@ -20,7 +20,7 @@ jobs: build-server-images: uses: ./.github/workflows/_docker-build.yml with: - namespace_repository: flwr/server + namespace-repository: flwr/server file: src/docker/server build-args: | FLWR_VERSION=${{ github.event.inputs.flwr-version }} diff --git a/src/docker/server/Dockerfile b/src/docker/server/Dockerfile index a20864e7d7bf..9bf3214bb42c 100644 --- a/src/docker/server/Dockerfile +++ b/src/docker/server/Dockerfile @@ -1,7 +1,7 @@ # Copyright 2023 Flower Labs GmbH. All Rights Reserved. -ARG BASE_IMAGE_VERSION=22.04 -FROM flwr/base:$BASE_IMAGE_VERSION +ARG BASE_IMAGE_VERSION=py3.11-ubuntu22.04 +FROM flwr/base:$BASE_IMAGE_VERSION as server WORKDIR /app ARG FLWR_VERSION @@ -9,5 +9,5 @@ RUN python -m pip install -U --no-cache-dir flwr[rest]==${FLWR_VERSION} ENTRYPOINT ["python", "-c", "from flwr.server import run_server; run_server()"] # Test if Flower can be successfully installed and imported -FROM flwr/base:$BASE_VERSION +FROM server as test RUN python -c "from flwr.server import run_server"