Used when you want to install global tools which depends on Devcontainer features.
// .devcontainer/devcontainer.json
{
"initializeCommand": {
"ensure-aws-dir": "mkdir -p ${localEnv:HOME}/.aws"
},
"mounts": [
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=consistent"
]
}
// .devcontainer/devcontainer.json
{
"initializeCommand": {
"ensure-dotenv-file": "cp --no-clobber .env.example .env || true"
}
}
{
"mounts": [
"source=${devcontainerId}-fish-history,target=/home/vscode/.local/share/fish,type=volume"
]
}
RUN groupadd --gid 1000 vscode \
&& useradd --uid 1000 --gid 1000 -m vscode
Devcontainer automatically updates UID/GID to match host's ones
Add non-root user to a container
RUN su node -c "npm run prod"
Useful for Devcontainer / CICD caching
$ poetry config --local virtualenvs.in-project true
This will force poetry install --no-root
and also make
name
and version
optional.
https://python-poetry.org/docs/basic-usage/#operating-modes
# pyproject.toml
[tool.poetry]
package-mode = false
Create multiple pages without router (at the sacrifice of performance)
// vite.config.js
import { defineConfig } from "vite"
import { resolve } from "path"
export default defineConfig({
base: "./",
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
othello: resolve(__dirname, "components", "othello", "index.html")
}
},
}
})