Files
git.stella-ops.org/ops/devops/console/build-runner-image.sh
2025-12-07 15:09:30 +02:00

30 lines
981 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Builds the offline console CI runner image with baked npm/Playwright caches.
# IMAGE_TAG: docker tag to produce (default: stellaops/console-runner:offline)
# OUTPUT_TAR: optional path to save the image tarball for airgap use.
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IMAGE_TAG=${IMAGE_TAG:-stellaops/console-runner:offline}
DOCKERFILE=${DOCKERFILE:-ops/devops/console/Dockerfile.runner}
APP_DIR=${APP_DIR:-src/Web/StellaOps.Web}
OUTPUT_TAR=${OUTPUT_TAR:-}
if ! command -v docker >/dev/null 2>&1; then
echo "docker not found; install Docker/Podman before building the runner image." >&2
exit 1
fi
docker build -f "$ROOT/$DOCKERFILE" --build-arg APP_DIR="$APP_DIR" -t "$IMAGE_TAG" "$ROOT"
if [[ -n "$OUTPUT_TAR" ]]; then
mkdir -p "$(dirname "$OUTPUT_TAR")"
docker save "$IMAGE_TAG" -o "$OUTPUT_TAR"
fi
echo "Runner image built: $IMAGE_TAG"
if [[ -n "$OUTPUT_TAR" ]]; then
echo "Saved tarball: $OUTPUT_TAR"
fi