Customizing the build process in the project “docker/build-push-action” can be achieved through various input options. Here are the possible options with examples:
Specifying Dockerfile and context
The context
input is the path to the build context, and the file
input is the path to the Dockerfile relative to the build context. For example:
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
Using a custom builder
The builder
input allows you to specify a custom builder. For example:
uses: docker/build-push-action@v2
with:
builder: my-builder
Pinning to a specific version of Buildx and BuildKit
You can pin to a specific version of Buildx using the version
input and a specific version of BuildKit using the image
option in the driver-opts
input. For example:
uses: docker/setup-buildx-action@v3
with:
version: v0.10.0
uses: docker/build-push-action@v2
with:
driver-opts: image=buildkit:0.11.0
Cache management
The cache-from
and cache-to
inputs allow you to specify the cache sources and destinations. For example:
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Platform targets
The platform
input allows you to specify the platform targets. For example:
uses: docker/build-push-action@v2
with:
platform: linux/arm64
Secrets
The secrets
input allows you to specify secrets for authentication. For example:
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Environment variables
The env
input allows you to specify environment variables. For example:
uses: docker/build-push-action@v2
with:
env: MY_ENV_VAR=my_value
Build arguments
The build-args
input allows you to specify build arguments. For example:
uses: docker/build-push-action@v2
with:
build-args: BUILD_DATE=$(date)
Squashing images
The squash
input allows you to specify whether to squash the image. For example:
uses: docker/build-push-action@v2
with:
squash: true
Additional flags
The flags
input allows you to specify additional flags. For example:
uses: docker/build-push-action@v2
with:
flags: --no-cache
Sources:
- Configuring your GitHub Actions builder | Docker Docs
- Faster Multi-Platform Builds: Dockerfile Cross-Compilation Guide | Docker
- docker buildx prune | Docker Docs
- Environment variables for Docker Build | Docker Docs
- Create a builder · Cloud Native Buildpacks
- pack builder create · Cloud Native Buildpacks
- project.toml · Cloud Native Buildpacks
- builder.toml · Cloud Native Buildpacks
- pack buildpack package · Cloud Native Buildpacks
- Run image · Cloud Native Buildpacks
- Docker Github Actions | Docker