{"id":13533773,"url":"https://github.com/crazy-max/ghaction-docker-buildx","last_synced_at":"2025-04-01T22:30:36.286Z","repository":{"id":54879799,"uuid":"210062087","full_name":"crazy-max/ghaction-docker-buildx","owner":"crazy-max","description":":octocat: GitHub Action to set up Docker Buildx","archived":true,"fork":false,"pushed_at":"2021-01-22T16:27:14.000Z","size":13764,"stargazers_count":228,"open_issues_count":6,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-15T22:49:19.659Z","etag":null,"topics":["actions","buildx","docker","github-actions"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/docker-buildx","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crazy-max.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"crazy-max","custom":"https://www.paypal.me/crazyws"}},"created_at":"2019-09-21T22:44:00.000Z","updated_at":"2024-04-18T02:34:29.000Z","dependencies_parsed_at":"2022-08-14T05:31:12.507Z","dependency_job_id":null,"html_url":"https://github.com/crazy-max/ghaction-docker-buildx","commit_stats":{"total_commits":386,"total_committers":7,"mean_commits":"55.142857142857146","dds":0.4948186528497409,"last_synced_commit":"2a72a7204291f74fb62248a1672e2d2f321e4470"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fghaction-docker-buildx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fghaction-docker-buildx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fghaction-docker-buildx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fghaction-docker-buildx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crazy-max","download_url":"https://codeload.github.com/crazy-max/ghaction-docker-buildx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246720416,"owners_count":20822898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","buildx","docker","github-actions"],"created_at":"2024-08-01T07:01:22.950Z","updated_at":"2025-04-01T22:30:35.969Z","avatar_url":"https://github.com/crazy-max.png","language":"TypeScript","funding_links":["https://github.com/sponsors/crazy-max","https://www.paypal.me/crazyws"],"categories":["Community Resources"],"sub_categories":["Deployment"],"readme":"[![GitHub release](https://img.shields.io/github/release/crazy-max/ghaction-docker-buildx.svg?style=flat-square)](https://github.com/crazy-max/ghaction-docker-buildx/releases/latest)\n[![GitHub marketplace](https://img.shields.io/badge/marketplace-docker--buildx-blue?logo=github\u0026style=flat-square)](https://github.com/marketplace/actions/docker-buildx)\n[![Test workflow](https://img.shields.io/github/workflow/status/crazy-max/ghaction-docker-buildx/test?label=test\u0026logo=github\u0026style=flat-square)](https://github.com/crazy-max/ghaction-docker-buildx/actions?workflow=test)\n[![Codecov](https://img.shields.io/codecov/c/github/crazy-max/ghaction-docker-buildx?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/crazy-max/ghaction-docker-buildx)\n[![Become a sponsor](https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github\u0026style=flat-square)](https://github.com/sponsors/crazy-max)\n[![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal\u0026style=flat-square)](https://www.paypal.me/crazyws)\n\n## Moved to Docker organization\n\n**This action is ARCHIVED and will not receive any updates, update your workflows to use the official Docker actions.**\n\nReplace\n\n```yaml\n      - name: Set up Docker Buildx\n        uses: crazy-max/ghaction-docker-buildx@v3\n```\n\nWith\n\n```yaml\n      # https://github.com/docker/setup-qemu-action\n      - name: Set up QEMU\n        uses: docker/setup-qemu-action@v1\n      # https://github.com/docker/setup-buildx-action\n      - name: Set up Docker Buildx\n        uses: docker/setup-buildx-action@v1\n```\n\n## About\n\nGitHub Action to set up Docker [Buildx](https://github.com/docker/buildx).\n\nIf you are interested, [check out](https://git.io/Je09Y) my other :octocat: GitHub Actions!\n\n![GitHub Action to set up Docker Buildx](.github/ghaction-docker-buildx.png)\n\n___\n\n* [Usage](#usage)\n  * [Quick start](#quick-start)\n  * [Build and push to DockerHub](#build-and-push-to-dockerhub)\n  * [Leverage buildx cache](#leverage-buildx-cache)\n* [Projects using this action](#projects-using-this-action)\n* [Customizing](#customizing)\n  * [inputs](#inputs)\n  * [outputs](#outputs)\n  * [environment variables](#environment-variables)\n* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)\n* [Limitation](#limitation)\n* [How can I help?](#how-can-i-help)\n* [License](#license)\n\n## Usage\n\n### Quick start\n\nHere is a simple example to build a Docker image with buildx (BuildKit)\n\n```yaml\nname: buildx\n\non:\n  pull_request:\n    branches: master\n  push:\n    branches: master\n    tags:\n\njobs:\n  buildx:\n    runs-on: ubuntu-latest\n    steps:\n      -\n        name: Checkout\n        uses: actions/checkout@v2\n      -\n        name: Set up Docker Buildx\n        id: buildx\n        uses: crazy-max/ghaction-docker-buildx@v3\n        with:\n          buildx-version: latest\n          qemu-version: latest\n      -\n        name: Available platforms\n        run: echo ${{ steps.buildx.outputs.platforms }}\n      -\n        name: Run Buildx\n        run: |\n          docker buildx build \\\n            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \\\n            --output \"type=image,push=false\" \\\n            --file ./test/Dockerfile ./test\n```\n\n### Build and push to DockerHub\n\nAnother example to build and push [Diun](https://github.com/crazy-max/diun) Docker image on DockerHub.\n\n* On `push` event, Docker image `crazymax/diun:edge` is **built** and **pushed** on DockerHub.\n* On `pull_request` event, Docker image `crazymax/diun:edge` is **built**.\n* On `schedule` event, Docker image `crazymax/diun:nightly` is **built** and **pushed** on DockerHub.\n* On `push tags` event, Docker image `crazymax/diun:\u003cversion\u003e` and `crazymax/diun:latest` is **built** and **pushed** on DockerHub.\n\n```yaml\nname: buildx\n\non:\n  schedule:\n    - cron: '0 10 * * *' # everyday at 10am\n  pull_request:\n    branches: master\n  push:\n    branches: master\n    tags:\n      - v*\n\njobs:\n  buildx:\n    runs-on: ubuntu-latest\n    steps:\n      -\n        name: Checkout\n        uses: actions/checkout@v2\n      -\n        name: Prepare\n        id: prepare\n        run: |\n          DOCKER_IMAGE=crazymax/diun\n          DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x\n          VERSION=edge\n\n          if [[ $GITHUB_REF == refs/tags/* ]]; then\n            VERSION=${GITHUB_REF#refs/tags/v}\n          fi\n          if [ \"${{ github.event_name }}\" = \"schedule\" ]; then\n            VERSION=nightly\n          fi\n\n          TAGS=\"--tag ${DOCKER_IMAGE}:${VERSION}\"\n          if [[ $VERSION =~ ^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$ ]]; then\n            TAGS=\"$TAGS --tag ${DOCKER_IMAGE}:latest\"\n          fi\n\n          echo ::set-output name=docker_image::${DOCKER_IMAGE}\n          echo ::set-output name=version::${VERSION}\n          echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \\\n            --build-arg VERSION=${VERSION} \\\n            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \\\n            --build-arg VCS_REF=${GITHUB_SHA::8} \\\n            ${TAGS} --file ./test/Dockerfile ./test\n      -\n        name: Set up Docker Buildx\n        uses: crazy-max/ghaction-docker-buildx@v3\n      -\n        name: Docker Buildx (build)\n        run: |\n          docker buildx build --output \"type=image,push=false\" ${{ steps.prepare.outputs.buildx_args }}\n      -\n        name: Login to DockerHub\n        if: success() \u0026\u0026 github.event_name != 'pull_request'\n        uses: docker/login-action@v1\n        with:\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n      -\n        name: Docker Buildx (push)\n        if: success() \u0026\u0026 github.event_name != 'pull_request'\n        run: |\n          docker buildx build --output \"type=image,push=true\" ${{ steps.prepare.outputs.buildx_args }}\n      -\n        name: Inspect image\n        if: always() \u0026\u0026 github.event_name != 'pull_request'\n        run: |\n          docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}\n```\n\n### Leverage buildx cache\n\nYou can leverage cache using [@actions/cache](https://github.com/actions/cache) with this action.\n\n```yaml\nname: buildx\n\non:\n  pull_request:\n    branches: master\n  push:\n    branches: master\n\njobs:\n  buildx:\n    runs-on: ubuntu-latest\n    steps:\n      -\n        name: Checkout\n        uses: actions/checkout@v2\n      -\n        name: Set up Docker Buildx\n        uses: crazy-max/ghaction-docker-buildx@v3\n      -\n        name: Cache Docker layers\n        uses: actions/cache@v2\n        id: cache\n        with:\n          path: /tmp/.buildx-cache\n          key: ${{ runner.os }}-buildx-${{ github.sha }}\n          restore-keys: |\n            ${{ runner.os }}-buildx-\n      -\n        name: Docker Buildx (build)\n        run: |\n          docker buildx build \\\n            --cache-from \"type=local,src=/tmp/.buildx-cache\" \\\n            --cache-to \"type=local,dest=/tmp/.buildx-cache\" \\\n            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \\\n            --output \"type=image,push=false\" \\\n            --tag crazymax/diun:latest \\\n            --file ./Dockerfile-diun ./\n      -\n        name: Login to DockerHub\n        uses: docker/login-action@v1\n        with:\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n      -\n        name: Docker Buildx (push)\n        run: |\n          docker buildx build \\\n            --cache-from \"type=local,src=/tmp/.buildx-cache\" \\\n            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \\\n            --output \"type=image,push=true\" \\\n            --tag crazymax/diun:latest \\\n            --file ./Dockerfile-diun ./\n      -\n        name: Inspect image\n        run: |\n          docker buildx imagetools inspect crazymax/diun:latest\n```\n\n## Projects using this action\n\n* [Diun](https://github.com/crazy-max/diun)\n* [GO Simple Tunnel](https://github.com/ginuerzh/gost)\n* [RSSHub](https://github.com/DIYgod/RSSHub)\n* [Cloudflared](https://github.com/crazy-max/docker-cloudflared)\n\n## Customizing\n\n### inputs\n\nFollowing inputs can be used as `step.with` keys\n\n| Name             | Type    | Default   | Description                        |\n|------------------|---------|-----------|------------------------------------|\n| `buildx-version` | String  | `latest`  | [Buildx](https://github.com/docker/buildx) version. Example: `v0.3.0` |\n| `qemu-version`   | String  | `latest`  | [qemu-user-static](https://github.com/multiarch/qemu-user-static) version (Docker tag). Example: `4.2.0-7` |\n\n### outputs\n\nFollowing outputs are available\n\n| Name          | Type    | Description                           |\n|---------------|---------|---------------------------------------|\n| `platforms`   | String  | Available platforms (comma separated) |\n\n### environment variables\n\nThe following [official docker environment variables](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) are supported:\n\n| Name            | Type    | Default      | Description                                    |\n|-----------------|---------|-------------|-------------------------------------------------|\n| `DOCKER_CONFIG` | String  | `~/.docker` | The location of your client configuration files |\n\n## Keep up-to-date with GitHub Dependabot\n\nSince [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)\nhas [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),\nto enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:\n\n```yaml\nversion: 2\nupdates:\n  # Maintain dependencies for GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n```\n\n## Limitation\n\nThis action is only available for Linux [virtual environments](https://help.github.com/en/articles/virtual-environments-for-github-actions#supported-virtual-environments-and-hardware-resources).\n\n## How can I help?\n\nAll kinds of contributions are welcome :raised_hands:! The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon: You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) :clap: or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! :rocket:\n\nThanks again for your support, it is much appreciated! :pray:\n\n## License\n\nMIT. See `LICENSE` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazy-max%2Fghaction-docker-buildx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrazy-max%2Fghaction-docker-buildx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazy-max%2Fghaction-docker-buildx/lists"}