✨ feat: add devcontainer
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# from https://github.com/devcontainers/features/blob/2951f0481a488ea43a6f2ea6f18a47f0a0bf744d/src/common-utils/scripts/bash_theme_snippet.sh#L20
|
||||
# bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
|
||||
__bash_prompt() {
|
||||
local userpart='`export XIT=$? \
|
||||
&& [ ! -z "${GITHUB_USER:-}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER:-} " || echo -n "\[\033[0;32m\]\u " \
|
||||
&& [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
|
||||
local gitbranch='`\
|
||||
if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
|
||||
export BRANCH="$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null)"; \
|
||||
if [ "${BRANCH:-}" != "" ]; then \
|
||||
echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH:-}" \
|
||||
&& if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
|
||||
git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
|
||||
echo -n " \[\033[1;33m\]✗"; \
|
||||
fi \
|
||||
&& echo -n "\[\033[0;36m\]) "; \
|
||||
fi; \
|
||||
fi`'
|
||||
local lightblue='\[\033[1;34m\]'
|
||||
local removecolor='\[\033[0m\]'
|
||||
PS1="${userpart} ${lightblue}\w ${gitbranch}${removecolor}\$ "
|
||||
unset -f __bash_prompt
|
||||
}
|
||||
__bash_prompt
|
||||
@@ -0,0 +1,116 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
|
||||
{
|
||||
"name": "m-tartari.github.io",
|
||||
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
|
||||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
|
||||
"dockerComposeFile": [
|
||||
"docker-compose.yml"
|
||||
],
|
||||
// The 'service' property is the name of the service for the container that VS Code should
|
||||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
|
||||
"service": "devcontainer",
|
||||
// The optional 'workspaceFolder' property is the path VS Code should open by default when
|
||||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Uncomment the next line if you want start specific services in your Docker Compose config.
|
||||
// "runServices": [],
|
||||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
|
||||
// "shutdownAction": "none",
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
"postCreateCommand": "bash .devcontainer/post_create.sh",
|
||||
"postStartCommand": "npm ci",
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
// Workbench
|
||||
"workbench.iconTheme": "vscode-icons",
|
||||
// Files
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.exclude": {
|
||||
"**/*.pyc": true,
|
||||
"**/.git": false
|
||||
},
|
||||
// Editor & Linting
|
||||
"prettier.printWidth": 150,
|
||||
"editor.suggestSelection": "first",
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
|
||||
"editor.detectIndentation": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"editor.tokenColorCustomizations": {
|
||||
"textMateRules": [
|
||||
{
|
||||
"scope": [
|
||||
"comment"
|
||||
],
|
||||
"settings": {
|
||||
"fontStyle": "italic"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// git
|
||||
"git.autofetch": true,
|
||||
"git.confirmSync": false,
|
||||
"git.enableSmartCommit": true,
|
||||
"git-graph.dialog.rebase.ignoreDate": false,
|
||||
"diffEditor.ignoreTrimWhitespace": false,
|
||||
"diffEditor.wordWrap": "off",
|
||||
// Javascript
|
||||
"javascript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.suggest.paths": true,
|
||||
// JSON
|
||||
"[json,jsonc]": {
|
||||
"editor.defaultFormatter": "vscode.json-language-features",
|
||||
"json.format.enable": true
|
||||
},
|
||||
// Testing
|
||||
"vitest.enable": true
|
||||
},
|
||||
"extensions": [
|
||||
"adam-bender.commit-message-editor",
|
||||
"christian-kohler.path-intellisense",
|
||||
"codezombiech.gitignore",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"firefox-devtools.vscode-firefox-debug",
|
||||
"formulahendry.auto-close-tag",
|
||||
"formulahendry.auto-rename-tag",
|
||||
"github.copilot",
|
||||
"github.copilot-chat",
|
||||
"gruntfuggly.todo-tree",
|
||||
"ibm.output-colorizer",
|
||||
"mhutchie.git-graph",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"naumovs.color-highlight",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"vitest.explorer",
|
||||
"vscode-icons-team.vscode-icons",
|
||||
"waderyan.gitblame",
|
||||
"wayou.vscode-todo-highlight"
|
||||
]
|
||||
}
|
||||
}
|
||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "devcontainer"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
services:
|
||||
devcontainer:
|
||||
image: m-tartari.github.io-dev
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
container_name: devcontainer-m-tartari.github.io
|
||||
hostname: m-tartari.github.io-dev
|
||||
command: sleep infinity
|
||||
ports:
|
||||
- '5173:5173'
|
||||
- '4173:4173'
|
||||
volumes:
|
||||
- ..:/workspaces/m-tartari.github.io:cached
|
||||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
|
||||
# cap_add:
|
||||
# - SYS_PTRACE
|
||||
# security_opt:
|
||||
# - seccomp:unconfined
|
||||
@@ -0,0 +1,2 @@
|
||||
# Update the bash PS1 to include git details
|
||||
cat .devcontainer/bash_prompt.sh >> $HOME/.bashrc
|
||||
Reference in New Issue
Block a user