diff options
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..766e8d7 --- /dev/null +++ b/build.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Build Fluorine Manager using Docker. +# +# Usage: +# ./build.sh # Build AppImage + staging dir +# ./build.sh shell # Drop into the build container for debugging +# +# Prerequisites: Docker or Podman + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# Auto-detect container runtime +if command -v podman >/dev/null 2>&1; then + DOCKER=podman +elif command -v docker >/dev/null 2>&1; then + DOCKER=docker +else + echo "ERROR: Neither podman nor docker found in PATH" + exit 1 +fi +IMAGE_NAME="fluorine-builder" +CONTAINER_NAME="fluorine-build-$$" + +cd "${SCRIPT_DIR}" + +# Build the Docker image if it doesn't exist or Dockerfile changed +echo "=== Ensuring build image is up to date ===" +${DOCKER} build -t "${IMAGE_NAME}" docker/ + +if [ "${1:-}" = "shell" ]; then + echo "=== Dropping into build container shell ===" + exec ${DOCKER} run --rm -it \ + -v "${SCRIPT_DIR}:/src:rw" \ + -w /src \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + "${IMAGE_NAME}" \ + bash +fi + +echo "=== Starting build ===" +${DOCKER} run --rm \ + -v "${SCRIPT_DIR}:/src:rw" \ + -w /src \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + --name "${CONTAINER_NAME}" \ + "${IMAGE_NAME}" \ + bash /src/docker/build-inner.sh + +echo "" +echo "=== Done ===" +if ls build/*.AppImage >/dev/null 2>&1; then + echo "AppImage: $(ls build/*.AppImage)" +fi +echo "Staging: build/staging/" |
