refactor: Container-only builds for consistency

- Remove --no-container option (never build on real host)
- Simplify build.sh to always use containers
- Fix Dockerfile user permissions
- Update help text and argument parsing
- Pass arguments correctly to container builds
This commit is contained in:
2025-08-31 12:58:30 +02:00
parent 1db6185454
commit 6fbaa95725
2 changed files with 25 additions and 33 deletions

View File

@@ -52,8 +52,6 @@ Zero OS Alpine Initramfs Builder
Usage: $0 [OPTIONS]
Options:
--container Force container build
--no-container Force native build
--clean Clean build (remove all artifacts first)
--skip-tests Skip boot tests
--keep-artifacts Keep build artifacts after completion
@@ -78,14 +76,6 @@ EOF
function parse_arguments() {
while [[ $# -gt 0 ]]; do
case $1 in
--container)
USE_CONTAINER="true"
shift
;;
--no-container)
USE_CONTAINER="false"
shift
;;
--clean)
CLEAN_BUILD="true"
shift
@@ -286,26 +276,29 @@ function main() {
# Setup environment
setup_build_environment
# Determine build method
if [[ "$USE_CONTAINER" == "auto" ]]; then
if in_container; then
log_info "Already in container, using native build"
main_build_process
elif command_exists "podman" || command_exists "docker"; then
log_info "Container runtime available, using container build"
docker_detect_runtime
docker_build_container
docker_run_build "./scripts/build.sh --no-container"
else
log_info "No container runtime, using native build"
main_build_process
fi
elif [[ "$USE_CONTAINER" == "true" ]]; then
# Always use container builds for consistency
if in_container; then
log_info "Already in container, proceeding with build"
main_build_process
elif command_exists "podman" || command_exists "docker"; then
log_info "Starting container build"
docker_detect_runtime
docker_build_container
docker_run_build "./scripts/build.sh --no-container"
# Pass through relevant arguments to container
local container_args=""
if [[ "$SKIP_TESTS" == "true" ]]; then
container_args="$container_args --skip-tests"
fi
if [[ "$KEEP_ARTIFACTS" == "true" ]]; then
container_args="$container_args --keep-artifacts"
fi
docker_run_build "./scripts/build.sh${container_args}"
else
main_build_process
log_error "Container runtime required (podman or docker)"
log_error "Install with: apt-get install podman"
return 1
fi
# Cleanup if requested