Building Binaries in Konflux
This guide provides guidelines on how to build binaries within Konflux.
Theory
The fundamental process involves creating a Containerfile to encapsulate your binary build process, similar to the production of container images. This allows you to define applications and components in Konflux as you normally would.
If you’re unfamiliar with Containerfiles, consult the official Dockerfile documentation.
Example
Let’s assume you have a shell script named build-binary.sh
in your repository that compiles your binary. A basic Containerfile would resemble this:
FROM quay.io/fedora/fedora:rawhide (1)
COPY build-binary.sh build-binary.sh (2)
COPY /app (3)
RUN ./build-binary.sh (4)
1 | Choose an appropriate base image that provides the necessary build tools. quay.io/fedora/fedora:rawhide is just an example. |
2 | Copy the build script into the Docker image. |
3 | Copy your source code into the Docker image. |
4 | Execute the build script. |
Other Considerations
If you want to use hermetic builds, ensure you’ve pre-fetched all dependencies as described in prefetching dependencies. This ensures that your builds are reproducible and isolated.