mirror of https://github.com/docker/buildx.git
				
				
				
			
		
			
				
	
	
	
		
			1.4 KiB
		
	
	
	
	
	
			
		
		
	
	
			1.4 KiB
		
	
	
	
	
	
CI/CD
GitHub Actions
Docker provides a GitHub Action that will build and push your image using Buildx. Here is a simple workflow:
name: ci
on:
  push:
    branches:
      - 'main'
jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Login to DockerHub
        uses: docker/login-action@v2 
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: user/app:latest
In this example we are also using 3 other actions:
setup-buildxaction will create and boot a builder using by default thedocker-containerbuilder driver. This is not required but recommended using it to be able to build multi-platform images, export cache, etc.setup-qemuaction can be useful if you want to add emulation support with QEMU to be able to build against more platforms.loginaction will take care to log in against a Docker registry.