Skip to content

Commit 931578e

Browse files
authored
Merge pull request #36 from silasly/fix/dockerfile-dev-venv-volume
fix: handle Docker named volume for .venv in dev entrypoint
2 parents 5db4858 + d3754df commit 931578e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Dockerfile.dev

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ set -e
3232
# Check if the venv has a working Python (catches cross-platform mismatch)
3333
if ! /app/backend/.venv/bin/python -c "import sys" 2>/dev/null; then
3434
echo "[dev-entrypoint] Installing dependencies (venv missing or incompatible)..."
35-
rm -rf /app/backend/.venv
36-
cd /app/backend && uv sync && uv pip install "watchdog[watchmedo]"
35+
# Docker named volumes can't always be rm -rf'd, so try rm first and warn if it fails
36+
rm_err_file="$(mktemp)"
37+
if ! rm -rf /app/backend/.venv 2>"$rm_err_file"; then
38+
echo "[dev-entrypoint] Warning: failed to remove /app/backend/.venv; continuing with 'uv venv --clear'." >&2
39+
cat "$rm_err_file" >&2
40+
fi
41+
rm -f "$rm_err_file"
42+
cd /app/backend && uv venv --clear && uv sync && uv pip install "watchdog[watchmedo]"
3743
echo "[dev-entrypoint] Dependencies installed."
3844
else
3945
# Venv works — run uv sync to pick up any new/changed dependencies
4046
echo "[dev-entrypoint] Syncing dependencies..."
41-
cd /app/backend && uv sync --quiet 2>/dev/null || true
47+
if ! (cd /app/backend && uv sync --quiet); then
48+
echo "[dev-entrypoint] Warning: dependency sync failed; continuing with existing environment." >&2
49+
fi
4250
# Ensure watchmedo is there too
4351
if ! command -v watchmedo >/dev/null 2>&1; then
4452
cd /app/backend && uv pip install "watchdog[watchmedo]"

0 commit comments

Comments
 (0)