build
rfswift build
Build custom Docker images from simplified YAML recipe files.
Synopsis
rfswift build [-r RECIPE_FILE] [-t TAG] [--no-cache]The build command creates Docker images using RF Swift’s simplified YAML recipe format. This provides an easier alternative to Dockerfiles for building custom RF Swift images with specific tools and configurations.
Options
| Flag | Description | Default | Example |
|---|---|---|---|
-r, --recipe STRING |
Path to recipe file | rfswift-recipe.yaml |
-r my-recipe.yaml |
-t, --tag STRING |
Override tag from recipe | From recipe | -t my_custom:v1 |
--no-cache |
Build without using cache | false | --no-cache |
Examples
Basic Usage
Build from default recipe:
rfswift buildBuild from specific recipe:
rfswift build -r custom-sdr-recipe.yamlBuild with custom tag:
rfswift build -r my-recipe.yaml -t my_image:testBuild without cache:
rfswift build -r recipe.yaml --no-cacheReal-World Scenarios
Create custom SDR environment:
# Create recipe
cat > sdr-custom.yaml << 'EOF'
name: my_sdr_custom
tag: sdr_custom:v1.0
base: penthertz/rfswift_noble:sdr_light
packages:
- gqrx-sdr
- inspectrum
- urh
scripts:
- apt-get clean
- rm -rf /var/lib/apt/lists/*
EOF
# Build
rfswift build -r sdr-custom.yamlRecipe File Format
Basic Structure
# Image metadata
name: my_custom_image
tag: my_custom:v1.0
base: penthertz/rfswift_noble:sdr_full
# Package installation
packages:
- package1
- package2
- package3
# Environment variables
environment:
- VAR1=value1
- VAR2=value2
# File copies
files:
- src: local/file.txt
dest: /container/path/
# Custom commands
commands:
- command1
- command2
# Cleanup scripts
scripts:
- cleanup_command1
- cleanup_command2
# Working directory
workdir: /root/workspaceComplete Example
name: advanced_sdr_setup
tag: advanced_sdr:v2.0
base: penthertz/rfswift_noble:sdr_full
# Install additional tools
packages:
- gqrx-sdr
- inspectrum
- urh
- universal-radio-hacker
- gr-gsm
- gr-lte
# Set environment
environment:
- SDR_BUFFER_SIZE=262144
- DISPLAY=:0
- PULSE_SERVER=tcp:127.0.0.1:34567
# Copy custom files
files:
- src: ./configs/sdr-config.conf
dest: /root/.config/
- src: ./scripts/startup.sh
dest: /usr/local/bin/
- src: ./tools/custom-tool
dest: /opt/tools/
# Post-installation commands
commands:
- chmod +x /usr/local/bin/startup.sh
- chmod +x /opt/tools/custom-tool
- ln -s /opt/tools/custom-tool /usr/local/bin/
- mkdir -p /root/captures
- mkdir -p /root/analysis
# Cleanup
scripts:
- apt-get clean
- rm -rf /var/lib/apt/lists/*
- rm -rf /tmp/*
- rm -rf /root/.cache/*
# Set working directory
workdir: /root/workspaceRecipe Sections
name (Required)
Image name for documentation purposes.
name: my_custom_sdrtag (Required)
Docker image tag (repository:tag format).
tag: my_custom_sdr:v1.0Can be overridden with -t flag:
rfswift build -r recipe.yaml -t override_tag:v2base (Required)
Base image to build from. Usually an RF Swift image.
base: penthertz/rfswift_noble:sdr_fullCommon base images:
penthertz/rfswift_noble:sdr_full- Complete SDR stackpenthertz/rfswift_noble:sdr_light- Lightweight SDRpenthertz/rfswift_noble:bluetooth- Bluetooth toolspenthertz/rfswift_noble:wifi- WiFi toolspenthertz/rfswift_noble:hardware- Hardware security tools
packages (Optional)
APT packages to install.
packages:
- gqrx-sdr
- inspectrum
- wireshark
- python3-pipenvironment (Optional)
Environment variables to set.
environment:
- PATH=/opt/tools:$PATH
- CUSTOM_VAR=value
- DEBUG=1files (Optional)
Files to copy into the image.
files:
- src: ./local/config.txt
dest: /root/.config/
- src: ./scripts/
dest: /opt/scripts/
- src: ./tool
dest: /usr/local/bin/toolPaths:
src: Relative to recipe file locationdest: Absolute path in container
commands (Optional)
Commands to run during build.
commands:
- chmod +x /usr/local/bin/script.sh
- pip3 install custom-package
- git clone https://github.com/user/repo /opt/repo
- make -C /opt/repo installscripts (Optional)
Cleanup scripts run at the end of the build.
scripts:
- apt-get clean
- rm -rf /var/lib/apt/lists/*
- rm -rf /tmp/*
- history -cworkdir (Optional)
Default working directory for the image.
workdir: /root/projectsTroubleshooting
Recipe File Not Found
Error: Error: recipe file not found
Solutions:
# Check file exists
ls -l rfswift-recipe.yaml
# Use absolute path
rfswift build -r /full/path/to/recipe.yaml
# Check current directory
pwdInvalid Recipe Format
Error: Error parsing recipe: invalid YAML
Solutions:
# Validate YAML syntax
yamllint recipe.yaml
# Check indentation (must use spaces, not tabs)
cat -A recipe.yaml | grep "^I"
# Common issues:
# - Missing colons after keys
# - Incorrect indentation
# - Tabs instead of spacesBase Image Not Found
Error: Error: base image not found
Solutions:
# Pull base image first
rfswift images pull penthertz/rfswift_noble:sdr_full
# Check available images
rfswift images local
# Verify base image name in recipe
grep "^base:" recipe.yamlPackage Installation Failed
Error: E: Unable to locate package
Solutions:
# Update package lists in recipe
packages:
- apt-update # Add this first
# Or add to commands section
commands:
- apt-get update
- apt-get install -y your-package
# Check package name spelling
apt-cache search package-nameFile Copy Failed
Error: COPY failed: stat /src/file: no such file or directory
Solutions:
# Check source file exists relative to recipe
ls -l ./configs/file.txt
# Use correct relative path
files:
- src: ./configs/file.txt # Relative to recipe location
dest: /root/.config/
# Verify directory structure
tree .Build Cache Issues
Problem: Build not reflecting changes
Solution:
# Force rebuild without cache
rfswift build -r recipe.yaml --no-cache
# Clear Docker build cache
docker builder pruneRelated Commands
run- Run containers from built imagescommit- Save modified containers as imagesexport- Export built imagesimages- Manage built imagesdelete- Remove built images
files section must exist relative to the recipe file location. Use ./ prefix for clarity and always verify files exist before building.--no-cache when you want to ensure all packages are updated and all commands run fresh. Otherwise, Docker’s layer caching speeds up repeated builds.