Build Docker image
Buddy lets developers build Docker images with code from a Git repository and the selected Dockerfile. Setting up a Docker-focused pipeline is as easy as setting up any other type of delivery in the service.
Configuration
- First, you need to specify which repository should the image be based on. Buddy has native integrations with GitHub, Bitbucket and GitLab, but you can hook up any other repository as well:
Image loading...Selecting repository
- With the repository successfully synchronized, you can add the pipeline. A pipeline can be triggered on specific events, manually on click, or recurrently on a time interval:
Image loading...Adding new pipeline
- If you set the pipeline to run on a Git push, specify the branch, tag, or wildcard for which the build will run:
Image loading...Pipeline configuration
- With the pipeline prepared, we can add the Build Image from the Docker section of the action roster:
Image loading...Adding Build Docker image action
- In the action details, specify the Dockerfile location and the context directory in which the image will be built:
Image loading...Configuring Docker build details
Building private images
If the image is private (e.g. FROM: my-registry.com/buddy/my-image:latest
) and requires logging into a registry, you can configure the integration in the Build tab in the action.
Buddy natively integrates with Docker Hub, Amazon ECR, Google GCR, and Google Artifact Registry. You can also use any other private registry:
Image loading...Selecting Docker registry
Building Multi-Arch Docker images
The Multi-Arch Build Image action allows you to set the target architecture for which the Docker image is built:
- linux/amd64
- linux/arm64
- linux/arm/v7
- linux/arm/v6
To choose the platform, add the action to the pipeline and use the dropdown menu in the Target platform section:
Image loading...Choosing target platform for multi-arch Docker images
Docker image Continuous Delivery
With Buddy, you can automate basically any type of DevOps process. For example, you can create a pipeline that will perform the following tasks on every push to the selected branch – just by adding new actions to the already existing ones:
- Run unit tests
- Check the Dockerfile for issues
- Build a Docker image
- Run the image and test it for errors
- Push the image to the selected registry
- Send a notification to a Slack channel
Here's how these tasks look like transferred into pipeline actions:
Image loading...Docker pipeline example
Build arguments
By default, Buddy doesn't pass the environment variables to the build. If you want to pass them, you have to define build args and provide the environment variable that you want to pass as a value.
Apart from this, you can define your own build arguments in the action:
Image loading...Build arguments
Target build stage
If your Dockerfile contains multiple build stages of an image, you can specify which stage should be built in the Build tab:
Image loading...Target build stage
Provenance
In the Build Docker image action, you can enable the creation of provenance attestations. These attestations encompass essential data, such as build timestamps, build parameters and environment configurations, version control metadata, and source code details. To utilize the feature, use the dropdown menu in the action and select the desired mode:
Image loading...Provenance settings
Secrets
Buddy gives you the option to add secrets that are passed to a Docker build using two secret types: env or file. When using the env type, you need to specify the secret name and select an environment variable from a dropdown list. When using the file type, you need to specify the secret name and select a file from the filesystem:
Image loading...Secrets
Cache
All Docker layers are automatically cached during the build process. This caching mechanism ensures that future builds only create layers that have been modified since the last build, which drastically reduces the build time. While it is possible to prune dangling images, we do not recommend doing so. If needed, you can enable this option in the Options section:
Image loading...Cache options
đź“š Learn more about Build Docker image action features, integrations and alternatives.
Sep 24, 2024