This directory contains build scripts that run during image creation. Scripts are executed in numerical order.
Scripts are named with a number prefix (e.g., 10-build.sh, 20-onepassword.sh) and run in ascending order during the container build process.
10-build.sh- Main build script for base system modifications, package installation, and service configuration
20-onepassword.sh.example- Example showing how to install software from third-party RPM repositories (Google Chrome, 1Password)
To use an example script:
- Remove the
.exampleextension - Make it executable:
chmod +x build/20-yourscript.sh - The build system will automatically run it in numerical order
Create numbered scripts for different purposes:
# 10-build.sh - Base system (already exists)
# 20-drivers.sh - Hardware drivers
# 30-development.sh - Development tools
# 40-gaming.sh - Gaming software
# 50-cleanup.sh - Final cleanup tasks#!/usr/bin/env bash
set -oue pipefail
echo "Running custom setup..."
# Your commands here- Use descriptive names:
20-nvidia-drivers.shis better than20-stuff.sh - One purpose per script: Easier to debug and maintain
- Clean up after yourself: Remove temporary files and disable temporary repos
- Test incrementally: Add one script at a time and test builds
- Comment your code: Future you will thank present you
To temporarily disable a script without deleting it:
- Rename it with
.disabledextension:20-script.sh.disabled - Or remove execute permission:
chmod -x build/20-script.sh
The Containerfile runs scripts like this:
RUN /ctx/build/10-build.shIf you want to run multiple scripts, you can:
- Modify Containerfile to run each script explicitly
- Create a runner script that executes all numbered scripts
- Use the default and keep everything in
10-build.sh(simplest)
- Scripts run as root during build
- Build context is available at
/ctx - Use dnf5 for package management (not dnf or yum)
- Always use
-yflag for non-interactive installs