Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions claude.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Install Playwright CLI globally (provides the playwright-cli command used by Claude Code).
RUN npm install -g @playwright/cli@latest

# Install Supabase CLI binary so the agent can run migrations against the
# host's local Supabase instance (reached via host.docker.internal).
# The npm package blocks global installs, so we fetch the release binary directly.
# The real binary lives at supabase-bin; a wrapper script at /usr/local/bin/supabase
# auto-injects --db-url when SUPABASE_DB_URL is set (see scripts/supabase-wrapper.sh).
RUN ARCH=$(dpkg --print-architecture) \
&& curl -fsSL "https://github.com/supabase/cli/releases/latest/download/supabase_linux_${ARCH}.tar.gz" \
| tar xz -C /usr/local/bin \
&& mv /usr/local/bin/supabase /usr/local/bin/supabase-bin
COPY scripts/supabase-wrapper.sh /usr/local/bin/supabase
RUN chmod +x /usr/local/bin/supabase

# Install Chromium's system dependencies using the Playwright bundled with
# @playwright/cli so the dependency versions stay aligned.
RUN /usr/local/lib/node_modules/@playwright/cli/node_modules/.bin/playwright install-deps chromium \
Expand Down
9 changes: 9 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ EOF
echo "The app will start in guest-only mode."
fi

# Migrations: SUPABASE_DB_URL is injected by run-claude-in-docker.sh
# and the supabase wrapper script auto-injects --db-url for db/migration commands.
if [ -n "$SUPABASE_DB_URL" ]; then
echo ""
echo "Supabase migrations configured (--db-url auto-injected)."
echo " supabase db push # apply local migrations"
echo " supabase migration up # apply pending migrations"
fi

elif command -v supabase &> /dev/null; then
echo ""
echo "Supabase CLI detected."
Expand Down
1 change: 1 addition & 0 deletions scripts/run-claude-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PORT=${1:-5173}
docker run -it --rm \
-p $PORT:5173 \
--add-host=host.docker.internal:host-gateway \
-e SUPABASE_DB_URL="postgresql://postgres:postgres@host.docker.internal:54322/postgres" \
-v "$(pwd):/app" \
-v claude-home:/home/node \
session-timer-claude
21 changes: 21 additions & 0 deletions scripts/supabase-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Wrapper around supabase-bin that auto-injects --db-url when SUPABASE_DB_URL
# is set (i.e., inside a Docker container reaching the host's Postgres).
# This lets agents run `supabase db push` without remembering the flag.

REAL_SUPABASE=/usr/local/bin/supabase-bin

# Pass through unchanged if SUPABASE_DB_URL is not set or --db-url already provided
if [ -z "${SUPABASE_DB_URL:-}" ] || [[ " $* " == *" --db-url "* ]]; then
exec "$REAL_SUPABASE" "$@"
fi

# Subcommands that accept --db-url
case "${1:-} ${2:-}" in
"db push"|"db pull"|"db diff"|"db lint"|"migration up"|"migration repair"|"migration squash")
exec "$REAL_SUPABASE" "$@" --db-url "$SUPABASE_DB_URL"
;;
*)
exec "$REAL_SUPABASE" "$@"
;;
esac