chore: phase 0 reproducible docker/dev setup with version pinning

This commit is contained in:
Jonas Miederer 2026-09-09 09:44:59 +00:00
parent af993bd43f
commit 1e8050611c
12 changed files with 286 additions and 31 deletions

View file

@ -11,7 +11,9 @@
},
"mounts": [
"source=${localEnv:USERPROFILE}/.ssh,target=/mnt/host-ssh,type=bind,readonly",
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind",
"source=kirche-opencode-share,target=/home/vscode/.local/share/opencode,type=volume",
"source=kirche-opencode-config,target=/home/vscode/.config/opencode,type=volume"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
@ -29,7 +31,7 @@
"esbenp.prettier-vscode"
],
"settings": {
"python.defaultInterpreterPath": "/srv/kirche-einfach/backend/.venv/bin/python"
"python.defaultInterpreterPath": "/opt/venv/bin/python"
}
}
}

View file

@ -6,12 +6,34 @@ set -e
REPO=/srv/kirche-einfach
# Venv lives outside the bind-mount (see backend/Dockerfile).
export UV_PYTHON_INSTALL_DIR=/opt/python UV_PROJECT_ENVIRONMENT=/opt/venv
echo "=== Setting up kirche-einfach ==="
# Backend deps into the venv volume (setup runs via sudo; handed to vscode below).
# Writable dirs first: this script runs via sudo as root, but the editor and
# most commands run as vscode. (A root-created backend/data/ or venv used to
# break the DB and the interpreter for vscode.)
mkdir -p "$REPO/backend/data" \
"$REPO/frontend/node_modules" \
/opt/python /opt/venv \
/home/vscode/.cache \
/home/vscode/.local/share/uv \
/home/vscode/.local/share/opencode \
/home/vscode/.config/opencode
chown -R vscode:vscode "$REPO/backend/data" \
"$REPO/frontend/node_modules" \
/opt/python /opt/venv \
/home/vscode/.cache \
/home/vscode/.local/share/uv \
/home/vscode/.local/share/opencode \
/home/vscode/.config/opencode 2>/dev/null || true
# Backend deps into /opt/venv, as vscode (a root-owned venv is unusable for
# the editor; uv resolves at setup time, no lockfile is committed).
echo "--- Installing Python dependencies ---"
cd "$REPO/backend"
uv sync
su vscode -c "uv sync"
# opencode CLI (dev tooling; intentionally not baked into the image).
if [ ! -x /home/vscode/.opencode/bin/opencode ]; then
@ -57,13 +79,8 @@ EOF
# entrypoint on every start).
echo "--- Syncing canonical flows ---"
cd "$REPO/backend"
uv run python scripts/sync_flows.py --sync || echo "WARN: flow sync failed (check backend/flows and LFX)"
su vscode -c "uv run python scripts/sync_flows.py --sync" || echo "WARN: flow sync failed (check backend/flows and LFX)"
echo ""
echo "=== Setup complete ==="
echo "Forgejo username: $FORGEJO_USERNAME"
# Hand dirs back to vscode (this script runs via sudo; uv creates caches as root)
chown -R vscode:vscode "$REPO/backend/.venv" \
"$REPO/frontend/node_modules" \
/home/vscode/.cache 2>/dev/null || true