mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-09 16:23:44 +03:00
refactor(devcontainer): new devcontainer specification based on debian
with debian based container features such as poetry, black etc. can be more easily integrated
This commit is contained in:
parent
12176c5718
commit
9ac50c787e
|
@ -1,98 +1,104 @@
|
||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
|
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
|
||||||
{
|
{
|
||||||
"name": "ublue-os/forge",
|
"name": "ublue-os/forge",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
"image": "mcr.microsoft.com/devcontainers/base:alpine-3.17",
|
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
|
||||||
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/python:1": {
|
||||||
|
"installTools": true,
|
||||||
|
"version": "3.11"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers-contrib/features/black:2": {
|
||||||
|
"version": "24.4.1"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers-contrib/features/poetry:2": {
|
||||||
|
"version": "1.8.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Container user definition - This is needed for compatibility with podman -> https://github.com/containers/podman/issues/15001#issuecomment-1193321924
|
||||||
"remoteUser": "vscode",
|
"remoteUser": "vscode",
|
||||||
// podman needs this
|
|
||||||
"containerUser": "vscode",
|
"containerUser": "vscode",
|
||||||
"runArgs": [
|
// Container environment variables
|
||||||
// run container as current user
|
|
||||||
"--userns=keep-id",
|
|
||||||
// disable selinux isolation that breaks bind mounts
|
|
||||||
"--security-opt=label=disable"
|
|
||||||
],
|
|
||||||
// Configure environment variables
|
|
||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"POETRY_VIRTUALENVS_CREATE": "false",
|
"POETRY_VIRTUALENVS_CREATE": "false",
|
||||||
"POETRY_VERSION": "1.3.1"
|
"LAZYGIT_VERSION": "0.41.0"
|
||||||
},
|
},
|
||||||
"remoteEnv": {
|
// Install and configure DEV tools
|
||||||
// Add path for packages installed with poetry
|
|
||||||
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin:/home/vscode/.local/pipx/venvs/poetry/bin"
|
|
||||||
},
|
|
||||||
// Mounts from host system
|
|
||||||
"mounts": [
|
|
||||||
"source=/run/user/${localEnv:UID:1000}/podman/podman.sock,target=/run/podman/podman.sock,type=bind"
|
|
||||||
],
|
|
||||||
// Install DevTools
|
|
||||||
"postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh",
|
"postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh",
|
||||||
// Configure tool-specific properties.
|
// VSCode settings
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"settings": {
|
"settings": {
|
||||||
|
// Terminal settings
|
||||||
|
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||||
"terminal.integrated.profiles.linux": {
|
"terminal.integrated.profiles.linux": {
|
||||||
|
"bash": {
|
||||||
|
"path": "bash",
|
||||||
|
"icon": "terminal-bash"
|
||||||
|
},
|
||||||
"zsh": {
|
"zsh": {
|
||||||
"path": "zsh",
|
"path": "zsh"
|
||||||
"args": ["-l"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
// Editor settings
|
||||||
"terminal.integrated.automation.linux": "zsh",
|
|
||||||
"terminal.integrated.automationProfile.linux": { "path": "zsh" },
|
|
||||||
"editor.suggestSelection": "first",
|
"editor.suggestSelection": "first",
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.formatOnPaste": true,
|
"editor.formatOnPaste": true,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"**/ansible/**/*.yml": "ansible"
|
".ansible-lint": "yaml",
|
||||||
|
".gitmessage": "git-commit",
|
||||||
|
"**/pb_*.yml": "ansible",
|
||||||
|
"**/playbooks/*.yml": "ansible",
|
||||||
|
"**/roles/**/tasks/*.yml": "ansible",
|
||||||
|
"inventory_*": "ansible"
|
||||||
},
|
},
|
||||||
"[ansible]": {
|
// Ansible configuration
|
||||||
"editor.defaultFormatter": "redhat.ansible",
|
"ansible.validation.enabled": true,
|
||||||
"editor.formatOnPaste": true,
|
"ansible.validation.lint.arguments": "-c .ansible-lint",
|
||||||
"editor.insertSpaces": true,
|
"ansible.ansible.reuseTerminal": true,
|
||||||
"editor.tabSize": 2
|
"ansible.lightspeed.enabled": true,
|
||||||
},
|
"ansible.lightspeed.suggestions.enabled": true,
|
||||||
// "ansible.ansible.path": "/home/vscode/.local/bin/ansible",
|
"ansible.lightspeed.URL": "https://c.ai.ansible.redhat.com",
|
||||||
// "ansible.python.interpreterPath": "/usr/local/bin/python3",
|
// Template configuration
|
||||||
"ansible.ansible.useFullyQualifiedCollectionNames": true,
|
"templates.folder": "./.vscode/templates",
|
||||||
"ansible.ansibleLint.enabled": true,
|
// Spell-Check configuration
|
||||||
// "ansible.ansibleLint.path": "/home/vscode/.local/bin/ansible-lint",
|
|
||||||
"ansible.ansibleLint.arguments": "-c ${containerWorkspaceFolder}/ansible/.ansible-lint",
|
|
||||||
"cSpell.customDictionaries": {
|
"cSpell.customDictionaries": {
|
||||||
"project-words": {
|
"project-words": {
|
||||||
"name": "custom-dictionary",
|
"name": "custom-dictionary",
|
||||||
"path": "${workspaceFolder}/.vscode/cspell_custom.txt",
|
"path": "${workspaceRoot}/.vscode/cspell_custom.txt",
|
||||||
"description": "Words used in this project",
|
"description": "Words used in this project",
|
||||||
"addWords": true
|
"addWords": true
|
||||||
},
|
},
|
||||||
"custom": true,
|
"custom": true,
|
||||||
"internal-terms": false
|
"internal-terms": false
|
||||||
},
|
},
|
||||||
"docker.host": "unix:///run/podman/podman.sock",
|
// Workspace colors
|
||||||
"peacock.affectActivityBar": false,
|
"peacock.affectActivityBar": false,
|
||||||
"peacock.affectStatusBar": true,
|
"peacock.affectStatusBar": true,
|
||||||
"peacock.affectTitleBar": false,
|
"peacock.affectTitleBar": false,
|
||||||
"peacock.surpriseMeOnStartup": false
|
"peacock.surpriseMeOnStartup": false
|
||||||
},
|
},
|
||||||
|
// VSCode Extensions installed in DevContainer
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"bungcip.better-toml",
|
"be5invis.toml",
|
||||||
"DavidAnson.vscode-markdownlint",
|
"codezombiech.gitignore",
|
||||||
|
"davidanson.vscode-markdownlint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"GitHub.vscode-pull-request-github",
|
"gitlab.gitlab-workflow",
|
||||||
"Gruntfuggly.todo-tree",
|
"gruntfuggly.todo-tree",
|
||||||
"jamesls.jmespath-vscode",
|
"johnpapa.vscode-peacock",
|
||||||
"kokakiwi.vscode-just",
|
|
||||||
"ms-azuretools.vscode-docker",
|
"ms-azuretools.vscode-docker",
|
||||||
"ms-kubernetes-tools.vscode-kubernetes-tools",
|
"ms-python.autopep8",
|
||||||
"nico-castell.linux-desktop-file",
|
"ms-python.black-formatter",
|
||||||
|
"ms-python.python",
|
||||||
|
"mutantdino.resourcemonitor",
|
||||||
"redhat.ansible",
|
"redhat.ansible",
|
||||||
"redhat.vscode-yaml",
|
"redhat.vscode-yaml",
|
||||||
"samuelcolvin.jinjahtml",
|
"streetsidesoftware.code-spell-checker-german",
|
||||||
"shakram02.bash-beautify",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"streetsidesoftware.code-spell-checker"
|
"tamasfe.even-better-toml"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"workbench.colorCustomizations": {
|
"workbench.colorCustomizations": {
|
||||||
"sash.hoverBorder": "#7cb9e3",
|
"sash.hoverBorder": "#a1cfe7",
|
||||||
"statusBar.background": "#52a2da",
|
"statusBar.background": "#78badd",
|
||||||
"statusBarItem.hoverBackground": "#2c8bcd",
|
"statusBarItem.hoverBackground": "#4fa5d3",
|
||||||
"statusBarItem.remoteBackground": "#52a2da",
|
"statusBarItem.remoteBackground": "#78badd",
|
||||||
"statusBar.foreground": "#15202b",
|
"statusBar.foreground": "#15202b",
|
||||||
"statusBarItem.remoteForeground": "#15202b"
|
"statusBarItem.remoteForeground": "#15202b"
|
||||||
},
|
},
|
||||||
"peacock.remoteColor": "#52a2da",
|
"peacock.remoteColor": "#78badd",
|
||||||
"cSpell.enableFiletypes": ["ansible", "shellscript"]
|
"cSpell.enableFiletypes": ["ansible", "shellscript"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
#!/bin/bash
|
|
||||||
cat <<EOM
|
|
||||||
install-dev-tools.sh
|
|
||||||
=============================================
|
|
||||||
This script customizes the devcontainer setup
|
|
||||||
=============================================
|
|
||||||
EOM
|
|
||||||
# Bash colors
|
# Bash colors
|
||||||
RED="\e[31m"
|
RED="\e[31m"
|
||||||
YELLOW="\e[33m"
|
YELLOW="\e[33m"
|
||||||
|
@ -15,29 +8,19 @@ ENDCOLOR="\e[0m"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}Updating OS${ENDCOLOR}"
|
echo -e "${YELLOW}Updating OS${ENDCOLOR}"
|
||||||
echo ""
|
echo ""
|
||||||
sudo apk update && sudo apk upgrade
|
sudo apt-get update && sudo apt-get upgrade -y
|
||||||
|
|
||||||
## Install additional tools
|
## Install additional tools
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}Installing additional tools${ENDCOLOR}"
|
echo -e "${YELLOW}Installing additional tools${ENDCOLOR}"
|
||||||
echo ""
|
echo ""
|
||||||
sudo apk add git-extras --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
|
sudo apt-get -y install --no-install-recommends git-extras gnupg2
|
||||||
sudo apk add py3-pip
|
|
||||||
python3 -m pip install --user pipx
|
|
||||||
python3 -m pipx ensurepath
|
|
||||||
pipx install poetry
|
|
||||||
|
|
||||||
## Install podman remote
|
## lazygit -> version specified in devcontainer.json
|
||||||
echo ""
|
LAZYGIT_SOURCE=https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz
|
||||||
echo -e "${YELLOW}Installing podman-remote${ENDCOLOR}"
|
LAZYGIT_TMP=/tmp/lazygit.tar.gz
|
||||||
echo ""
|
wget -O $LAZYGIT_TMP $LAZYGIT_SOURCE
|
||||||
PODMAN_SOURCE=https://github.com/containers/podman/releases/download/v4.4.4/podman-remote-static-linux_amd64.tar.gz
|
sudo tar -xf $LAZYGIT_TMP -C /usr/bin
|
||||||
PODMAN_TMP=/tmp/podman.tar.gz
|
|
||||||
wget -O $PODMAN_TMP $PODMAN_SOURCE
|
|
||||||
sudo tar -xf $PODMAN_TMP -C /tmp
|
|
||||||
sudo mv /tmp/bin/podman-remote-static-linux_amd64 /usr/bin/podman
|
|
||||||
podman system connection add devcontainer_host unix:///run/podman/podman.sock
|
|
||||||
sudo rm -rf /tmp/bin
|
|
||||||
|
|
||||||
# Add git commit template
|
# Add git commit template
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -45,11 +28,12 @@ echo -e "${YELLOW}Configuring git${ENDCOLOR}"
|
||||||
echo ""
|
echo ""
|
||||||
git config --local commit.template .gitmessage
|
git config --local commit.template .gitmessage
|
||||||
|
|
||||||
|
|
||||||
# Install python dependencies
|
# Install python dependencies
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}Installing python dependencies${ENDCOLOR}"
|
echo -e "${YELLOW}Installing project dependencies${ENDCOLOR}"
|
||||||
echo ""
|
echo ""
|
||||||
poetry install -C /workspaces/forge/setup/ansible
|
poetry install --no-root -C /workspaces/forge/setup/ansible
|
||||||
|
|
||||||
# Install ansible dependencies
|
# Install ansible dependencies
|
||||||
# echo ""
|
# echo ""
|
||||||
|
|
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
|
@ -1,11 +1,12 @@
|
||||||
# To get started with Dependabot version updates, you'll need to specify which
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
# package ecosystems to update and where the package manifests are located.
|
# package ecosystems to update and where the package manifests are located.
|
||||||
# Please see the documentation for all configuration options:
|
# Please see the documentation for more information:
|
||||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
# https://containers.dev/guide/dependabot
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
- package-ecosystem: "devcontainers"
|
||||||
directory: "/" # Location of package manifests
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: weekly
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"MD024": { "allow_different_nesting": true }
|
|
||||||
}
|
|
10
.markdownlint.yml
Normal file
10
.markdownlint.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
# Markdown Lint Configuration -> https://github.com/DavidAnson/vscode-markdownlint?tab=readme-ov-file#rules
|
||||||
|
MD013:
|
||||||
|
line_length: 90
|
||||||
|
tables: false
|
||||||
|
code_blocks: false
|
||||||
|
MD024:
|
||||||
|
siblings_only: true
|
||||||
|
MD046:
|
||||||
|
style: fenced
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"tabWidth": 2
|
|
||||||
}
|
|
3
.prettierrc.yml
Normal file
3
.prettierrc.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
# prettier configuration settings -> https://prettier.io/docs/en/configuration
|
||||||
|
tabWidth: 2
|
1
.vscode/cspell_custom.txt
vendored
1
.vscode/cspell_custom.txt
vendored
|
@ -7,6 +7,7 @@ getent
|
||||||
gitmessage
|
gitmessage
|
||||||
hostvars
|
hostvars
|
||||||
keygen
|
keygen
|
||||||
|
LAZYGIT
|
||||||
lineinfile
|
lineinfile
|
||||||
minica
|
minica
|
||||||
Mountpoint
|
Mountpoint
|
||||||
|
|
Loading…
Reference in a new issue