fix: persist Chrome profile data and settings across container restarts
- Add explicit --user-data-dir flag to Chrome wrapper to ensure profile data is stored in the persistent home directory - Add cont-init-home.sh script to properly initialize home directory structure on container startup with correct permissions - Ensure Chrome config directory exists before Chrome starts - Bump chart version to 0.1.13 This fixes the issue where Chrome loses authentication and settings after pod restarts by explicitly managing where Chrome stores its profile data. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
+12
-1
@@ -35,7 +35,16 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearm
|
||||
# Chrome wrapper: adds flags required for running inside a Docker container.
|
||||
# xdg-open (used by Claude Code on Linux) respects $BROWSER, so pointing it
|
||||
# here ensures the OAuth popup works without manual --no-sandbox invocations.
|
||||
RUN printf '#!/bin/bash\nexec /usr/bin/google-chrome-stable \\\n --no-sandbox \\\n --disable-dev-shm-usage \\\n --disable-gpu \\\n "$@"\n' > /usr/local/bin/google-chrome && \
|
||||
# Also explicitly sets user-data-dir to persist Chrome settings across restarts.
|
||||
RUN printf '#!/bin/bash\n\
|
||||
# Ensure Chrome data directory exists with proper permissions\n\
|
||||
mkdir -p "$HOME/.config/google-chrome"\n\
|
||||
exec /usr/bin/google-chrome-stable \\\n\
|
||||
--no-sandbox \\\n\
|
||||
--disable-dev-shm-usage \\\n\
|
||||
--disable-gpu \\\n\
|
||||
--user-data-dir="$HOME/.config/google-chrome" \\\n\
|
||||
"$@"\n' > /usr/local/bin/google-chrome && \
|
||||
chmod +x /usr/local/bin/google-chrome
|
||||
|
||||
# Install Node.js (LTS version for Happy Coder)
|
||||
@@ -87,6 +96,8 @@ COPY --chmod=755 scripts/startapp.sh /startapp.sh
|
||||
COPY --chmod=755 scripts/init-repo.sh /usr/local/bin/init-repo
|
||||
# Fix app user shell after baseimage-gui creates it at runtime
|
||||
COPY --chmod=755 scripts/cont-init-user.sh /etc/cont-init.d/20-fix-user-shell.sh
|
||||
# Initialize persistent home directory structure
|
||||
COPY --chmod=755 scripts/cont-init-home.sh /etc/cont-init.d/21-init-home.sh
|
||||
COPY --chmod=755 scripts/cont-init-sshd.sh /etc/cont-init.d/25-start-sshd.sh
|
||||
|
||||
# Set working directory
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: devcontainer
|
||||
description: Antigravity Dev Container with Happy Coder AI assistant
|
||||
type: application
|
||||
version: 0.1.12
|
||||
version: 0.1.13
|
||||
appVersion: "latest"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Initialize persistent home directory structure for the app user
|
||||
# This ensures Chrome settings and SSH keys persist across pod restarts
|
||||
|
||||
echo "=== Initializing persistent home directory ==="
|
||||
|
||||
# Ensure the user home directory exists with proper ownership
|
||||
if [ ! -d "/home/user" ]; then
|
||||
echo "Creating /home/user directory..."
|
||||
mkdir -p /home/user
|
||||
chown app:app /home/user
|
||||
fi
|
||||
|
||||
# Ensure critical directories exist for persistent data
|
||||
echo "Ensuring persistent directories exist..."
|
||||
mkdir -p /home/user/.config
|
||||
mkdir -p /home/user/.ssh
|
||||
mkdir -p /home/user/.cache
|
||||
|
||||
# Set proper ownership for all directories
|
||||
chown -R app:app /home/user
|
||||
|
||||
# Ensure SSH directory has proper permissions
|
||||
chmod 700 /home/user/.ssh
|
||||
|
||||
echo "Home directory initialization complete"
|
||||
Reference in New Issue
Block a user