@@ -37,7 +37,7 @@ export UKC_METRO="dummy-metro-for-local-run"
3737
3838
3939# Local-friendly Chrome flags (less restrictive than cloud) + custom DevTools frontend
40- export CHROMIUM_FLAGS=" --user-data-dir=/home/kernel /user-data --disable-dev-shm-usage --start-maximized --remote-allow-origins=* --no-sandbox --disable-setuid-sandbox --custom-devtools-frontend=http://localhost:8001/"
40+ export CHROMIUM_FLAGS=" --user-data-dir=/data /user-data --disable-dev-shm-usage --start-maximized --remote-allow-origins=* --no-sandbox --disable-setuid-sandbox --custom-devtools-frontend=http://localhost:8001/"
4141
4242echo " 🔧 Configuration:"
4343echo " Image: $IMAGE "
@@ -56,12 +56,35 @@ echo "🏃 Starting extended container with kernel-images run system..."
5656# Source common build vars
5757source ../../shared/ensure-common-build-run-vars.sh chromium-headful
5858
59- # Directory on host where recordings will be saved
59+ # Directory on host where recordings will be saved
6060HOST_RECORDINGS_DIR=" $SCRIPT_DIR /recordings"
6161mkdir -p " $HOST_RECORDINGS_DIR "
6262
63+ # Chromium data directory for persistence
64+ # Set CHROMIUM_DATA_HOST to customize location (default: ./chromium-data)
65+ # Set CHROMIUM_DATA_HOST="" to disable persistence (ephemeral mode)
66+ if [[ " ${CHROMIUM_DATA_HOST+set} " == " set" && -z " $CHROMIUM_DATA_HOST " ]]; then
67+ echo " 🔄 Using ephemeral Chromium data (no persistence)"
68+ CHROMIUM_DATA_VOLUME=" "
69+ else
70+ # Default to ./chromium-data if not specified
71+ CHROMIUM_DATA_HOST=" ${CHROMIUM_DATA_HOST:- $SCRIPT_DIR / chromium-data} "
72+ echo " 🗂️ Using persistent Chromium data directory: $CHROMIUM_DATA_HOST "
73+ CHROMIUM_DATA_REAL=$( realpath " $CHROMIUM_DATA_HOST " 2> /dev/null || echo " " )
74+ if [[ -z " $CHROMIUM_DATA_REAL " ]]; then
75+ # Path doesn't exist yet, try to create it first
76+ mkdir -p " $CHROMIUM_DATA_HOST "
77+ CHROMIUM_DATA_REAL=$( realpath " $CHROMIUM_DATA_HOST " 2> /dev/null || echo " " )
78+ if [[ -z " $CHROMIUM_DATA_REAL " ]]; then
79+ echo " ❌ Error: Invalid path $CHROMIUM_DATA_HOST "
80+ exit 1
81+ fi
82+ fi
83+ CHROMIUM_DATA_VOLUME=" ${CHROMIUM_DATA_REAL} :/data"
84+ fi
85+
6386# Build Chromium flags file and mount
64- CHROMIUM_FLAGS_DEFAULT=" --user-data-dir=/home/kernel /user-data --disable-dev-shm-usage --disable-gpu --start-maximized --disable-software-rasterizer --remote-allow-origins=*"
87+ CHROMIUM_FLAGS_DEFAULT=" --user-data-dir=/data /user-data --disable-dev-shm-usage --disable-gpu --start-maximized --disable-software-rasterizer --remote-allow-origins=*"
6588if [[ " $RUN_AS_ROOT " == " true" ]]; then
6689 CHROMIUM_FLAGS_DEFAULT=" $CHROMIUM_FLAGS_DEFAULT --no-sandbox --no-zygote"
6790fi
@@ -92,6 +115,11 @@ RUN_ARGS=(
92115 --mount type=bind,src=" $FLAGS_FILE " ,dst=/chromium/flags,ro
93116)
94117
118+ # Add Chromium data volume if specified
119+ if [[ -n " $CHROMIUM_DATA_VOLUME " ]]; then
120+ RUN_ARGS+=( -v " ${CHROMIUM_DATA_VOLUME} " )
121+ fi
122+
95123# Add URLS environment variable if provided
96124if [[ -n " ${URLS:- } " ]]; then
97125 echo " URLs: $URLS "
0 commit comments