chore: add a devcontainer setup #50

Merged
Philipp merged 3 commits from add-devcontainer into main 2025-12-27 01:02:37 +01:00
3 changed files with 11 additions and 11 deletions
Showing only changes of commit 4c12baef28 - Show all commits

View File

@@ -0,0 +1,7 @@
# .devcontainer/Dockerfile
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye
# CACHED INSTALLATION:
# Install global NPM packages here. This creates a cached Docker layer.
# We use 'su node' to ensure permissions are correct for the non-root user.
RUN su node -c "npm install -g @google/gemini-cli"

View File

@@ -11,9 +11,7 @@
},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/git-lfs:1": {},
"ghcr.io/devcontainers-extra/features/pipx-package:1": {
"packages": "pre-commit, ruff"
}
"ghcr.io/devcontainers-extra/features/pre-commit:2": {}
},
"customizations": {
"vscode": {
@@ -30,13 +28,13 @@
}
}
},
"postCreateCommand": "npm install",
"postStartCommand": "bash .devcontainer/setup.sh",
"remoteUser": "node",
"remoteUser": "vscode",
"updateRemoteUserUID": true,
"mounts": [
"source=pipx-venvs,target=/home/node/.local/share/pipx,type=volume",
"source=pipx-bin,target=/home/node/.local/bin,type=volume",
"source=pre-commit-cache,target=/home/node/.cache/pre-commit,type=volume",
"source=${localEnv:HOME}/.gemini,target=/home/node/.gemini,type=bind"
"source=${localEnv:USERPROFILE}/.gemini,target=/home/node/.gemini,type=bind"
]
}

View File

@@ -1,16 +1,11 @@
#!/bin/bash
# 1. Fix Git Permissions (Critical in Docker)
sudo chown -R $(whoami) .git
git config --global --add safe.directory $(pwd)
# 2. Re-connect Git Hooks
# 'pre-commit install' is idempotent (it checks if the hook exists and exits fast).
# It's safe to run on every start.
if command -v pre-commit &> /dev/null; then
pre-commit install
else
echo "⚠️ Warning: pre-commit not found. Skipping hook installation."
fi
# We REMOVED 'npm install' from here to speed up your daily workflow.