diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d620820..2ea8961f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,8 @@ name: Build and push DocsGPT Docker image on: - workflow_dispatch: - push: - branches: - - main + release: + types: [published] jobs: deploy: @@ -43,5 +41,7 @@ jobs: context: ./application push: true tags: | - ${{ secrets.DOCKER_USERNAME }}/docsgpt:latest - ghcr.io/${{ github.repository_owner }}/docsgpt:latest + ${{ secrets.DOCKER_USERNAME }}/docsgpt:${{ github.event.release.tag_name }},${{ secrets.DOCKER_USERNAME }}/docsgpt:latest + ghcr.io/${{ github.repository_owner }}/docsgpt:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/docsgpt:latest + cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt:latest + cache-to: type=inline diff --git a/.github/workflows/cife.yml b/.github/workflows/cife.yml index 67aadfbb..73a97755 100644 --- a/.github/workflows/cife.yml +++ b/.github/workflows/cife.yml @@ -1,10 +1,8 @@ name: Build and push DocsGPT-FE Docker image on: - workflow_dispatch: - push: - branches: - - main + release: + types: [published] jobs: deploy: @@ -44,5 +42,7 @@ jobs: context: ./frontend push: true tags: | - ${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest - ghcr.io/${{ github.repository_owner }}/docsgpt-fe:latest + ${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:${{ github.event.release.tag_name }},${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest + ghcr.io/${{ github.repository_owner }}/docsgpt-fe:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/docsgpt-fe:latest + cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest + cache-to: type=inline diff --git a/.github/workflows/docker-develop-build.yml b/.github/workflows/docker-develop-build.yml new file mode 100644 index 00000000..5edc69d7 --- /dev/null +++ b/.github/workflows/docker-develop-build.yml @@ -0,0 +1,49 @@ +name: Build and push DocsGPT Docker image for development + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + deploy: + if: github.repository == 'arc53/DocsGPT' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Login to ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker images to docker.io and ghcr.io + uses: docker/build-push-action@v4 + with: + file: './application/Dockerfile' + platforms: linux/amd64 + context: ./application + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/docsgpt:develop + ghcr.io/${{ github.repository_owner }}/docsgpt:develop + cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt:develop + cache-to: type=inline diff --git a/.github/workflows/docker-develop-fe-build.yml b/.github/workflows/docker-develop-fe-build.yml new file mode 100644 index 00000000..29ad4524 --- /dev/null +++ b/.github/workflows/docker-develop-fe-build.yml @@ -0,0 +1,49 @@ +name: Build and push DocsGPT FE Docker image for development + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + deploy: + if: github.repository == 'arc53/DocsGPT' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Login to ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker images to docker.io and ghcr.io + uses: docker/build-push-action@v4 + with: + file: './frontend/Dockerfile' + platforms: linux/amd64 + context: ./frontend + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:develop + ghcr.io/${{ github.repository_owner }}/docsgpt-fe:develop + cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:develop + cache-to: type=inline