From 367c78f8d25599d7be65e11c49393f6255e873a7 Mon Sep 17 00:00:00 2001 From: fidoriel <49869342+fidoriel@users.noreply.github.com> Date: Mon, 22 Jan 2024 01:46:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8B=20feat:=20CI=20Docker=20builds=20f?= =?UTF-8?q?or=20arm64v8=20(#1607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/container.yml | 67 ++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 949d39cfe0..23c6ad48cc 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -19,6 +19,10 @@ jobs: - name: Set up Docker uses: docker/setup-buildx-action@v3 + # Set up QEMU for cross-platform builds + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + # Log in to GitHub Container Registry - name: Log in to GitHub Container Registry uses: docker/login-action@v2 @@ -27,26 +31,53 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Run docker-compose build + # Prepare Docker Build - name: Build Docker images run: | cp .env.example .env - docker-compose build - docker build -f Dockerfile.multi --target api-build -t librechat-api . - # Get Tag Name - - name: Get Tag Name - id: tag_name - run: echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + # Tag and push librechat-api + - name: Docker metadata for librechat-api + id: meta-librechat-api + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository_owner }}/librechat-api + tags: | + type=raw,value=latest + type=semver,pattern={{version}} + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} - # Tag it properly before push to github - - name: tag image and push - run: | - docker tag librechat:latest ghcr.io/${{ github.repository_owner }}/librechat:${{ env.TAG_NAME }} - docker push ghcr.io/${{ github.repository_owner }}/librechat:${{ env.TAG_NAME }} - docker tag librechat:latest ghcr.io/${{ github.repository_owner }}/librechat:latest - docker push ghcr.io/${{ github.repository_owner }}/librechat:latest - docker tag librechat-api:latest ghcr.io/${{ github.repository_owner }}/librechat-api:${{ env.TAG_NAME }} - docker push ghcr.io/${{ github.repository_owner }}/librechat-api:${{ env.TAG_NAME }} - docker tag librechat-api:latest ghcr.io/${{ github.repository_owner }}/librechat-api:latest - docker push ghcr.io/${{ github.repository_owner }}/librechat-api:latest + - name: Build and librechat-api + uses: docker/build-push-action@v5 + with: + file: Dockerfile.multi + context: . + push: true + tags: ${{ steps.meta-librechat-api.outputs.tags }} + platforms: linux/amd64,linux/arm64 + target: api-build + + # Tag and push librechat + - name: Docker metadata for librechat + id: meta-librechat + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository_owner }}/librechat + tags: | + type=raw,value=latest + type=semver,pattern={{version}} + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build and librechat + uses: docker/build-push-action@v5 + with: + file: Dockerfile + context: . + push: true + tags: ${{ steps.meta-librechat.outputs.tags }} + platforms: linux/amd64,linux/arm64 + target: node