From 3eca1f55163de9411e82e2454f30c58087b04241 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Wed, 8 Jan 2025 13:53:57 +0100 Subject: [PATCH] ci: fix manifest when building multi stage (#9) Reviewed-on: https://gitea.t000-n.de/t.behrendt/ts3gotify/pulls/9 Co-authored-by: Timo Behrendt Co-committed-by: Timo Behrendt --- .gitea/workflows/cd.yaml | 36 +++++++++++++++++++++++++++++++++--- Dockerfile | 2 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index db7a826..93f7429 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -64,8 +64,38 @@ jobs: with: context: . file: ./Dockerfile - platform: linux/${{ matrix.arch }} + platforms: linux/${{ matrix.arch }} push: true + provenance: false tags: | - ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} - ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest + ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }} + + create_manifest: + name: Create manifest + needs: + - build_and_push + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get Metadata + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Create manifest + run: | + docker manifest create ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest \ + ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-amd64 \ + ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-arm64 + + docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest diff --git a/Dockerfile b/Dockerfile index c3e3d68..a500332 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ COPY --from=install /temp/dev/node_modules node_modules COPY . . RUN bun run build -FROM base as release +FROM base AS release COPY --from=install /temp/prod/node_modules node_modules COPY --from=build /app/dist .