Build Development Image #63
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
| # --------------------------------- | |
| # This workflow is used to build development images | |
| # and push them to GitHub Container Registry | |
| # | |
| # Published at: | |
| # ghcr.io/m0rtzz/overleaf/dev | |
| # | |
| # --------------------------------- | |
| name: Build Development Image | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| GHCR_REGISTRY: ghcr.io | |
| jobs: | |
| build-image: | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 8 | |
| matrix: | |
| image-name: | |
| [ | |
| web, | |
| webpack, | |
| real-time, | |
| project-history, | |
| linked-url-proxy, | |
| notifications, | |
| history-v1, | |
| filestore, | |
| document-updater, | |
| docstore, | |
| contacts, | |
| chat, | |
| clsi, | |
| ] | |
| platform: [linux/amd64, linux/arm64] | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| platform_pair: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| platform_pair: arm64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: "Checkout Current Repository" | |
| uses: actions/checkout@main | |
| with: | |
| ref: server-pro | |
| - name: "Setup node environment" | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22.x" | |
| - name: "Sync package-lock.json" | |
| run: | | |
| npm install --package-lock-only --ignore-scripts | |
| - name: "Login to GHCR" | |
| uses: docker/login-action@v3.0.0 | |
| with: | |
| registry: ${{ env.GHCR_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Disable buildx default attestations | |
| run: | | |
| echo "BUILDX_NO_DEFAULT_ATTESTATIONS=1" >> $GITHUB_ENV | |
| - name: "Clone Overleaf And Build" | |
| env: | |
| PLATFORM_PAIR: ${{ matrix.platform_pair }} | |
| run: | | |
| export BUILDX_NO_DEFAULT_ATTESTATIONS=1 | |
| cd ./develop/ | |
| bin/build ${{ matrix.image-name }} | |
| docker tag develop-${{ matrix.image-name }}:latest ${{ env.GHCR_REGISTRY }}/m0rtzz/overleaf/dev:${{ matrix.image-name }}-${PLATFORM_PAIR} | |
| docker push ${{ env.GHCR_REGISTRY }}/m0rtzz/overleaf/dev:${{ matrix.image-name }}-${PLATFORM_PAIR} | |
| merge: | |
| runs-on: ubuntu-latest | |
| needs: build-image | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image-name: | |
| [ | |
| web, | |
| webpack, | |
| real-time, | |
| project-history, | |
| linked-url-proxy, | |
| notifications, | |
| history-v1, | |
| filestore, | |
| document-updater, | |
| docstore, | |
| contacts, | |
| chat, | |
| clsi, | |
| ] | |
| steps: | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GHCR_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create and push manifest list (multi-arch tag) | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/m0rtzz/overleaf/dev:${{ matrix.image-name }} \ | |
| ghcr.io/m0rtzz/overleaf/dev:${{ matrix.image-name }}-amd64 \ | |
| ghcr.io/m0rtzz/overleaf/dev:${{ matrix.image-name }}-arm64 | |
| - name: Inspect manifest | |
| run: | | |
| docker buildx imagetools inspect ghcr.io/m0rtzz/overleaf/dev:${{ matrix.image-name }} | |
| clean-image: | |
| runs-on: ubuntu-latest | |
| needs: merge | |
| steps: | |
| - name: Delete old images | |
| uses: snok/container-retention-policy@v2 | |
| with: | |
| image-names: overleaf/dev* | |
| cut-off: 7 days ago UTC | |
| account-type: personal | |
| untagged-only: true | |
| token: ${{ secrets.GHCR_PAT }} |