feat: Update devcontainer setup with Dockerfile and improved script for pre-commit hooks
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m37s
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m37s
This commit is contained in:
@@ -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"
|
||||||
|
|||||||
@@ -11,9 +11,7 @@
|
|||||||
},
|
},
|
||||||
"ghcr.io/devcontainers/features/git:1": {},
|
"ghcr.io/devcontainers/features/git:1": {},
|
||||||
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
||||||
"ghcr.io/devcontainers-extra/features/pipx-package:1": {
|
"ghcr.io/devcontainers-extra/features/pre-commit:2": {}
|
||||||
"packages": "pre-commit, ruff"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
@@ -30,13 +28,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postCreateCommand": "npm install",
|
|
||||||
"postStartCommand": "bash .devcontainer/setup.sh",
|
"postStartCommand": "bash .devcontainer/setup.sh",
|
||||||
"remoteUser": "node",
|
"remoteUser": "vscode",
|
||||||
|
"updateRemoteUserUID": true,
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=pipx-venvs,target=/home/node/.local/share/pipx,type=volume",
|
"source=pipx-venvs,target=/home/node/.local/share/pipx,type=volume",
|
||||||
"source=pipx-bin,target=/home/node/.local/bin,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=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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# 1. Fix Git Permissions (Critical in Docker)
|
# 1. Fix Git Permissions (Critical in Docker)
|
||||||
sudo chown -R $(whoami) .git
|
|
||||||
git config --global --add safe.directory $(pwd)
|
git config --global --add safe.directory $(pwd)
|
||||||
|
|
||||||
# 2. Re-connect Git Hooks
|
# 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
|
if command -v pre-commit &> /dev/null; then
|
||||||
pre-commit install
|
pre-commit install
|
||||||
else
|
else
|
||||||
echo "⚠️ Warning: pre-commit not found. Skipping hook installation."
|
echo "⚠️ Warning: pre-commit not found. Skipping hook installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We REMOVED 'npm install' from here to speed up your daily workflow.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user