Build and publish Docker images #467
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 publish Docker images | |
| on: | |
| # allow manual runs | |
| workflow_dispatch: | |
| # build nightlies - at midnight every day | |
| schedule: | |
| - cron: '0 0 * * *' | |
| timezone: 'Europe/Warsaw' | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build: | |
| name: Build and publish container images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| strategy: | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| - linux/arm64 | |
| package: | |
| - repo: TeamPiped/Piped | |
| image: piped-frontend | |
| - repo: TeamPiped/Piped-Backend | |
| image: piped-backend | |
| - repo: TeamPiped/piped-proxy | |
| image: piped-proxy | |
| - repo: TeamPiped/bg-helper-server | |
| image: bg-helper-server | |
| steps: | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Generate image tag metadata | |
| id: meta | |
| run: echo "tags=${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.package.image }}:${{ steps.date.outputs.date }},${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.package.image }}:latest" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ matrix.package.repo }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Fix Dockerfile for backend image | |
| if: matrix.package.image == 'piped-backend' | |
| run: sed -i '/COPY VERSION/d' Dockerfile | |
| - name: Checkout this repository for frontend patches | |
| if: matrix.package.image == 'piped-frontend' || matrix.package.image == 'piped-proxy' | |
| uses: actions/checkout@v4 | |
| with: | |
| path: piped-docker | |
| - name: Apply frontend patches | |
| if: matrix.package.image == 'piped-frontend' | |
| run: git apply piped-docker/patches/frontend/*.patch | |
| - name: Apply proxy patches | |
| if: matrix.package.image == 'piped-proxy' | |
| run: git apply piped-docker/patches/proxy/*.patch | |
| - name: '[frontend] Disable linter' | |
| if: matrix.package.image == 'piped-frontend' | |
| run: sed -i '/eslint/d' vite.config.js | |
| - name: '[frontend] Add missing bindings for arm64' | |
| if: ${{ (matrix.package.image == 'piped-frontend') && (matrix.platform == 'linux/arm64') }} | |
| run: jq '.dependencies["@rolldown/binding-linux-arm64-musl"] = "1.1.1"' < package.json > package.json2 && mv package.json2 package.json | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} |