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 Docker Images" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - ffmpeg-master | |
| paths: | |
| - 'builder/**' | |
| - '.github/workflows/build-docker-image.yaml' | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build_docker_images: | |
| name: "Build ${{ matrix.target }} Docker Image" | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - target: linux64 | |
| variant: gpl | |
| platform: linux/amd64 | |
| runner: ubuntu-latest | |
| - target: linuxarm64 | |
| variant: gpl | |
| platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Free Disk Space | |
| run: | | |
| echo "Disk space before cleanup:" | |
| df -h | |
| # Remove unnecessary tools and files | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| sudo apt-get autoremove -y | |
| sudo apt-get clean | |
| echo "Disk space after cleanup:" | |
| df -h | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker Image | |
| run: | | |
| cd builder | |
| ./makeimage.sh ${{ matrix.target }} ${{ matrix.variant }} | |
| - name: Tag and Push Image | |
| run: | | |
| # The makeimage.sh creates a local image | |
| SOURCE_IMAGE="ghcr.io/${{ github.repository }}/${{ matrix.target }}-${{ matrix.variant }}:latest" | |
| # Push the main image | |
| docker push "$SOURCE_IMAGE" | |
| # Create and push date tag for versioning | |
| DATE_TAG="ghcr.io/${{ github.repository }}/${{ matrix.target }}-${{ matrix.variant }}:$(date +%Y%m%d)" | |
| docker tag "$SOURCE_IMAGE" "$DATE_TAG" | |
| docker push "$DATE_TAG" | |
| - name: Summary | |
| run: | | |
| echo "### 🎉 Docker Image Built and Pushed!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Image:** \`ghcr.io/${{ github.repository }}/${{ matrix.target }}-${{ matrix.variant }}:latest\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Date Tag:** \`ghcr.io/${{ github.repository }}/${{ matrix.target }}-${{ matrix.variant }}:$(date +%Y%m%d)\`" >> $GITHUB_STEP_SUMMARY |