From 77f5328ab9a738bc90f4fd384e362a1761d5f0af Mon Sep 17 00:00:00 2001 From: Anas Khafaga Date: Tue, 8 Oct 2024 15:36:48 +0300 Subject: [PATCH] feat(CI): Build docker images for development purposes --- .github/workflows/docker-develop-build.yml | 49 +++++++++++++++++++ .github/workflows/docker-develop-fe-build.yml | 49 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/workflows/docker-develop-build.yml create mode 100644 .github/workflows/docker-develop-fe-build.yml 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