From bd7df5637707d40b2856ceadd48f364e42feecaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=A0ari=C4=87?= Date: Sun, 24 Dec 2023 13:58:22 +0100 Subject: [PATCH] multiplatform build --- .github/workflows/docker-publish.yml | 27 +++++++++++++++++++++++++-- dockerfile-amd64 | 13 +++++++++++++ Dockerfile => dockerfile-arm64 | 0 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 dockerfile-amd64 rename Dockerfile => dockerfile-arm64 (100%) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 09fac82..a7a09f7 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -70,10 +70,11 @@ jobs: # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image - id: build-and-push + id: build-and-push-arm64 uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: context: . + file: dockerfile-arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -81,6 +82,19 @@ jobs: cache-to: type=gha,mode=max platforms: linux/arm64 + - name: Build and push Docker image + id: build-and-push-amd64 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + file: dockerfile-amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: linux/amd64 + # Sign the resulting Docker image digest except on PRs. # This will only write to the public Rekor transparency log when the Docker # repository is public to avoid leaking data. If you would like to publish @@ -91,7 +105,16 @@ jobs: env: # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable TAGS: ${{ steps.meta.outputs.tags }} - DIGEST: ${{ steps.build-and-push.outputs.digest }} + DIGEST: ${{ steps.build-and-push-arm64.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push-amd64.outputs.digest }} # This step uses the identity token to provision an ephemeral certificate # against the sigstore community Fulcio instance. run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/dockerfile-amd64 b/dockerfile-amd64 new file mode 100644 index 0000000..28c751b --- /dev/null +++ b/dockerfile-amd64 @@ -0,0 +1,13 @@ +FROM ghcr.io/isaric/docker-dlib:python-opencv-4.8.0-dlib-19.24.2-amd64 + +WORKDIR /python-docker + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt +RUN pip install debugpy + +COPY . . + +EXPOSE 5000 + +CMD [ "python3", "-m" , "flask", "--app", "main", "run", "--host=0.0.0.0"] diff --git a/Dockerfile b/dockerfile-arm64 similarity index 100% rename from Dockerfile rename to dockerfile-arm64