diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 1dcdc03..9d69bb9 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -26,9 +26,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: @@ -56,16 +53,31 @@ jobs: - name: Build and push Docker image id: build - uses: docker/build-push-action@v5 - with: - context: ./services/nextjs - file: ./deploy/docker/Dockerfile.prod - push: true - platforms: linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + run: | + TAGS="${{ steps.meta.outputs.tags }}" + + # Build the image + docker build \ + -t $(echo "$TAGS" | head -n 1) \ + -f ./deploy/docker/Dockerfile.prod \ + ./services/fastapi + + # Tag all versions + FIRST_TAG=$(echo "$TAGS" | head -n 1) + echo "$TAGS" | while read tag; do + if [ "$tag" != "$FIRST_TAG" ]; then + docker tag "$FIRST_TAG" "$tag" + fi + done + + # Push all tags + echo "$TAGS" | while read tag; do + docker push "$tag" + done + + # Get digest + DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$FIRST_TAG" | cut -d'@' -f2) + echo "digest=$DIGEST" >> $GITHUB_OUTPUT - name: Extract SHA tag id: extract-tag