secure set to True in prod #159
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker | |
| on: | |
| push: | |
| branches: ["main", "live"] | |
| workflow_dispatch: | |
| inputs: | |
| force_rebuild_frontend: | |
| description: "Force rebuild frontend (ignores change detection)" | |
| required: false | |
| default: false | |
| type: boolean | |
| force_rebuild_backend: | |
| description: "Force rebuild backend (ignores change detection)" | |
| required: false | |
| default: false | |
| type: boolean | |
| force_rebuild_docling-serve: | |
| description: "Force rebuild docling-serve (ignores change detection)" | |
| required: false | |
| default: false | |
| type: boolean | |
| skip_tests: | |
| description: "Skip deployment tests" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| frontend: | |
| - 'frontend/**' | |
| - name: Log in to GHCR | |
| if: ${{ steps.changes.outputs.frontend == 'true' || github.event.inputs.force_rebuild_frontend == 'true' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build Frontend Image | |
| if: ${{ steps.changes.outputs.frontend == 'true' || github.event.inputs.force_rebuild_frontend == 'true' }} | |
| run: | | |
| docker build ./frontend --file ./frontend/Dockerfile \ | |
| --tag ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-frontend:${{ github.ref_name }} \ | |
| --build-arg NUXT_PUBLIC_API_BASE=https://tutor.ethz.ch/api \ | |
| - name: Push frontend Image | |
| if: ${{ steps.changes.outputs.frontend == 'true' || github.event.inputs.force_rebuild_frontend == 'true' }} | |
| run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-frontend:${{ github.ref_name }} | |
| build-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| backend: | |
| - 'backend/**' | |
| - name: Log in to GHCR | |
| if: ${{ steps.changes.outputs.backend == 'true' || github.event.inputs.force_rebuild_backend == 'true' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build backend Image | |
| if: ${{ steps.changes.outputs.backend == 'true' || github.event.inputs.force_rebuild_backend == 'true' }} | |
| run: | | |
| docker build ./backend --file ./backend/Dockerfile \ | |
| --tag ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-backend:${{ github.ref_name }} \ | |
| # - name: Test if Backend Image is healthy | |
| # run: | | |
| # docker run -d --rm -p 8000:8000 --name backend-test ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-backend:${{ github.ref_name }} | |
| # sleep 15 | |
| # curl -f http://localhost:8000/health | |
| # docker stop backend-test | |
| - name: Push backend Image | |
| if: ${{ steps.changes.outputs.backend == 'true' || github.event.inputs.force_rebuild_backend == 'true' }} | |
| run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-backend:${{ github.ref_name }} | |
| build-docling-serve: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| docling-serve: | |
| - 'docling-serve/**' | |
| - name: Log in to GHCR | |
| if: ${{ steps.changes.outputs['docling-serve'] == 'true' || github.event.inputs.force_rebuild_docling-serve == 'true' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build Docling Serve Image | |
| if: ${{ steps.changes.outputs['docling-serve'] == 'true' || github.event.inputs.force_rebuild_docling-serve == 'true' }} | |
| run: | | |
| docker build ./docling-serve --file ./docling-serve/Dockerfile \ | |
| --tag ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-docling-serve:${{ github.ref_name }} \ | |
| - name: Push Docling Serve Image | |
| if: ${{ steps.changes.outputs['docling-serve'] == 'true' || github.event.inputs.force_rebuild_docling-serve == 'true' }} | |
| run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-docling-serve:${{ github.ref_name }} |