# Container Build Environment This directory contains OCI-compatible Containerfiles (Dockerfiles) for building the Android File Handler on different Linux distributions. These images match exactly the images used in the CI/CD pipeline. The project uses **Podman** as the container runtime. All commands below use Podman; if you have Docker installed, the Dockerfiles are OCI-compatible and will work with Docker as well. ## Quick Start ### Using Podman Compose (Recommended) Build for all distributions: ```bash podman-compose up --build ``` Build for a specific distribution: ```bash podman-compose up --build debian podman-compose up --build arch podman-compose up --build rhel ``` ### Using Prefect + Dagger (CI Pipeline Locally) The CI/CD pipeline uses Prefect and Dagger to orchestrate builds. You can run it locally: ```bash poetry install --with ci poetry run python -m ci.prefect_flow build-linux ``` ### Manual Podman Build Build the image: ```bash # Debian podman build -f scripts/docker/Dockerfile.debian -t android-file-handler-debian-builder . # Arch podman build -f scripts/docker/Dockerfile.arch -t android-file-handler-arch-builder . # RHEL/Fedora podman build -f scripts/docker/Dockerfile.rhel -t android-file-handler-rhel-builder . ``` Run the build: ```bash # Debian podman run --rm -v $(pwd):/workspace:Z -w /workspace android-file-handler-debian-builder # Arch podman run --rm -v $(pwd):/workspace:Z -w /workspace android-file-handler-arch-builder # RHEL/Fedora podman run --rm -v $(pwd):/workspace:Z -w /workspace android-file-handler-rhel-builder ``` ## Output After building, you'll find: - `dist/` - Final packaged files (.deb, .rpm, .pkg.tar.zst) - `pkg_dist_{distro}/` - Staging directories for package contents - `dist_{distro}/` - PyInstaller build outputs ## Images ### Debian Builder - **Image**: `ghcr.io/jmr-dev/android-file-handler-debian-builder:debian13-trixie` - **Base**: `debian:13` - **Python**: 3.13 (via pyenv) - **Tools**: Poetry, fpm, PyInstaller ### Arch Builder - **Image**: `ghcr.io/jmr-dev/android-file-handler-arch-builder:latest` - **Base**: `archlinux:latest` - **Python**: 3.13 (via pyenv) - **Tools**: Poetry, fpm, PyInstaller ### RHEL Builder - **Image**: `ghcr.io/jmr-dev/android-file-handler-rhel-builder:fedora42` - **Base**: `fedora:42` - **Python**: 3.13 (via pyenv) - **Tools**: Poetry, fpm, PyInstaller ## Troubleshooting ### Virtualenv Conflicts The Podman Compose configuration automatically excludes the host's `.venv` directory to prevent conflicts between the host Python environment and the container Python environment. Each container creates its own virtualenv in `/tmp/poetry-cache`. If you encounter virtualenv-related errors, ensure you're using the latest podman-compose.yml configuration. ### SELinux (Fedora/RHEL hosts) Volume mounts use the `:Z` suffix to apply the correct SELinux labels automatically. If you encounter permission errors, ensure the `:Z` suffix is present on volume mounts. ## Cleaning Up Remove build artifacts: ```bash rm -rf dist pkg_dist_* dist_* ``` Remove Podman containers and volumes: ```bash podman-compose down -v ``` ## Customization ### Override FPM Version Build with a specific fpm version: ```bash docker-compose build --build-arg FPM_VERSION=1.15.0 debian ``` ### Environment Variables All builds use these environment variables: - `CI_CD=true` - Runs in CI/CD mode - `DISTRO_TYPE` - Set to `debian`, `arch`, or `rhel` - `FPM_VERSION` - Version of fpm to use (default: 1.16.0) ## Notes - All images use Python 3.13 built from source with tkinter support - The builds are identical to what runs in GitHub Actions - Poetry and fpm are pre-installed in all images - The Python build script handles both PyInstaller and fpm packaging