diff --git a/README.md b/README.md new file mode 100644 index 0000000..194a97a --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +# 🪞 QEMU binfmt Mirror + +A mirror of [`tonistiigi/binfmt`](https://github.com/tonistiigi/binfmt) hosted on a self-hosted Gitea Container Registry to speed up multi-platform Docker builds in CI/CD pipelines. + +## Why? + +When building Docker images for multiple platforms (e.g. `linux/amd64` + `linux/arm64`) on an `amd64`-only runner, QEMU emulation is required. The `setup-qemu-action` pulls `tonistiigi/binfmt` from Docker Hub on every run — which can take **4–5 minutes** depending on network conditions. + +By mirroring the image locally, the pull happens at LAN speed and reduces this step to a **few seconds**. + +## Usage + +In your Gitea Actions workflow, point `setup-qemu-action` to this mirror: + +```yaml +- name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + image: git.mrunk.de/mrunknownde/binfmt:latest +``` + +Full example workflow with multi-platform build: + +```yaml +- uses: actions/checkout@v4 + +- name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + image: git.mrunk.de/mrunknownde/binfmt:latest + +- name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + cache-binary: true + +- name: Build and push + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: your-registry/your-image:latest +``` + +## Keeping the Mirror Up to Date + +This repo includes an automated workflow that re-mirrors the image every Monday at 03:00 UTC. + +To trigger a manual update: + +1. Go to **Actions** in this repository +2. Select **Mirror QEMU Image** +3. Click **Run workflow** + +## Mirror Workflow + +```yaml +name: Mirror QEMU Image + +on: + schedule: + - cron: '0 3 * * 1' + workflow_dispatch: + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: docker/login-action@v3 + with: + registry: git.mrunk.de + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Mirror tonistiigi/binfmt + run: | + docker pull tonistiigi/binfmt:latest + docker tag tonistiigi/binfmt:latest git.mrunk.de/mrunknownde/binfmt:latest + docker push git.mrunk.de/mrunknownde/binfmt:latest +``` + +## Credits + +Original image: [`tonistiigi/binfmt`](https://github.com/tonistiigi/binfmt) — MIT License \ No newline at end of file