mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-06 23:23:43 +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
|
||||
// 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",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/base:alpine-3.17",
|
||||
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
|
||||
"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",
|
||||
// podman needs this
|
||||
"containerUser": "vscode",
|
||||
"runArgs": [
|
||||
// run container as current user
|
||||
"--userns=keep-id",
|
||||
// disable selinux isolation that breaks bind mounts
|
||||
"--security-opt=label=disable"
|
||||
],
|
||||
// Configure environment variables
|
||||
// Container environment variables
|
||||
"containerEnv": {
|
||||
"POETRY_VIRTUALENVS_CREATE": "false",
|
||||
"POETRY_VERSION": "1.3.1"
|
||||
"LAZYGIT_VERSION": "0.41.0"
|
||||
},
|
||||
"remoteEnv": {
|
||||
// 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
|
||||
// Install and configure DEV tools
|
||||
"postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh",
|
||||
// Configure tool-specific properties.
|
||||
// VSCode settings
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
// Terminal settings
|
||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"bash": {
|
||||
"path": "bash",
|
||||
"icon": "terminal-bash"
|
||||
},
|
||||
"zsh": {
|
||||
"path": "zsh",
|
||||
"args": ["-l"]
|
||||
"path": "zsh"
|
||||
}
|
||||
},
|
||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||
"terminal.integrated.automation.linux": "zsh",
|
||||
"terminal.integrated.automationProfile.linux": { "path": "zsh" },
|
||||
// Editor settings
|
||||
"editor.suggestSelection": "first",
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"files.associations": {
|
||||
"**/ansible/**/*.yml": "ansible"
|
||||
".ansible-lint": "yaml",
|
||||
".gitmessage": "git-commit",
|
||||
"**/pb_*.yml": "ansible",
|
||||
"**/playbooks/*.yml": "ansible",
|
||||
"**/roles/**/tasks/*.yml": "ansible",
|
||||
"inventory_*": "ansible"
|
||||
},
|
||||
"[ansible]": {
|
||||
"editor.defaultFormatter": "redhat.ansible",
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 2
|
||||
},
|
||||
// "ansible.ansible.path": "/home/vscode/.local/bin/ansible",
|
||||
// "ansible.python.interpreterPath": "/usr/local/bin/python3",
|
||||
"ansible.ansible.useFullyQualifiedCollectionNames": true,
|
||||
"ansible.ansibleLint.enabled": true,
|
||||
// "ansible.ansibleLint.path": "/home/vscode/.local/bin/ansible-lint",
|
||||
"ansible.ansibleLint.arguments": "-c ${containerWorkspaceFolder}/ansible/.ansible-lint",
|
||||
// Ansible configuration
|
||||
"ansible.validation.enabled": true,
|
||||
"ansible.validation.lint.arguments": "-c .ansible-lint",
|
||||
"ansible.ansible.reuseTerminal": true,
|
||||
"ansible.lightspeed.enabled": true,
|
||||
"ansible.lightspeed.suggestions.enabled": true,
|
||||
"ansible.lightspeed.URL": "https://c.ai.ansible.redhat.com",
|
||||
// Template configuration
|
||||
"templates.folder": "./.vscode/templates",
|
||||
// Spell-Check configuration
|
||||
"cSpell.customDictionaries": {
|
||||
"project-words": {
|
||||
"name": "custom-dictionary",
|
||||
"path": "${workspaceFolder}/.vscode/cspell_custom.txt",
|
||||
"path": "${workspaceRoot}/.vscode/cspell_custom.txt",
|
||||
"description": "Words used in this project",
|
||||
"addWords": true
|
||||
},
|
||||
"custom": true,
|
||||
"internal-terms": false
|
||||
},
|
||||
"docker.host": "unix:///run/podman/podman.sock",
|
||||
// Workspace colors
|
||||
"peacock.affectActivityBar": false,
|
||||
"peacock.affectStatusBar": true,
|
||||
"peacock.affectTitleBar": false,
|
||||
"peacock.surpriseMeOnStartup": false
|
||||
},
|
||||
// VSCode Extensions installed in DevContainer
|
||||
"extensions": [
|
||||
"bungcip.better-toml",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"be5invis.toml",
|
||||
"codezombiech.gitignore",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"esbenp.prettier-vscode",
|
||||
"GitHub.vscode-pull-request-github",
|
||||
"Gruntfuggly.todo-tree",
|
||||
"jamesls.jmespath-vscode",
|
||||
"kokakiwi.vscode-just",
|
||||
"gitlab.gitlab-workflow",
|
||||
"gruntfuggly.todo-tree",
|
||||
"johnpapa.vscode-peacock",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"ms-kubernetes-tools.vscode-kubernetes-tools",
|
||||
"nico-castell.linux-desktop-file",
|
||||
"ms-python.autopep8",
|
||||
"ms-python.black-formatter",
|
||||
"ms-python.python",
|
||||
"mutantdino.resourcemonitor",
|
||||
"redhat.ansible",
|
||||
"redhat.vscode-yaml",
|
||||
"samuelcolvin.jinjahtml",
|
||||
"shakram02.bash-beautify",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
"streetsidesoftware.code-spell-checker-german",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"tamasfe.even-better-toml"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
],
|
||||
"settings": {
|
||||
"workbench.colorCustomizations": {
|
||||
"sash.hoverBorder": "#7cb9e3",
|
||||
"statusBar.background": "#52a2da",
|
||||
"statusBarItem.hoverBackground": "#2c8bcd",
|
||||
"statusBarItem.remoteBackground": "#52a2da",
|
||||
"sash.hoverBorder": "#a1cfe7",
|
||||
"statusBar.background": "#78badd",
|
||||
"statusBarItem.hoverBackground": "#4fa5d3",
|
||||
"statusBarItem.remoteBackground": "#78badd",
|
||||
"statusBar.foreground": "#15202b",
|
||||
"statusBarItem.remoteForeground": "#15202b"
|
||||
},
|
||||
"peacock.remoteColor": "#52a2da",
|
||||
"peacock.remoteColor": "#78badd",
|
||||
"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
|
||||
RED="\e[31m"
|
||||
YELLOW="\e[33m"
|
||||
|
@ -15,29 +8,19 @@ ENDCOLOR="\e[0m"
|
|||
echo ""
|
||||
echo -e "${YELLOW}Updating OS${ENDCOLOR}"
|
||||
echo ""
|
||||
sudo apk update && sudo apk upgrade
|
||||
sudo apt-get update && sudo apt-get upgrade -y
|
||||
|
||||
## Install additional tools
|
||||
echo ""
|
||||
echo -e "${YELLOW}Installing additional tools${ENDCOLOR}"
|
||||
echo ""
|
||||
sudo apk add git-extras --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
|
||||
sudo apk add py3-pip
|
||||
python3 -m pip install --user pipx
|
||||
python3 -m pipx ensurepath
|
||||
pipx install poetry
|
||||
sudo apt-get -y install --no-install-recommends git-extras gnupg2
|
||||
|
||||
## Install podman remote
|
||||
echo ""
|
||||
echo -e "${YELLOW}Installing podman-remote${ENDCOLOR}"
|
||||
echo ""
|
||||
PODMAN_SOURCE=https://github.com/containers/podman/releases/download/v4.4.4/podman-remote-static-linux_amd64.tar.gz
|
||||
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
|
||||
## lazygit -> version specified in devcontainer.json
|
||||
LAZYGIT_SOURCE=https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz
|
||||
LAZYGIT_TMP=/tmp/lazygit.tar.gz
|
||||
wget -O $LAZYGIT_TMP $LAZYGIT_SOURCE
|
||||
sudo tar -xf $LAZYGIT_TMP -C /usr/bin
|
||||
|
||||
# Add git commit template
|
||||
echo ""
|
||||
|
@ -45,11 +28,12 @@ echo -e "${YELLOW}Configuring git${ENDCOLOR}"
|
|||
echo ""
|
||||
git config --local commit.template .gitmessage
|
||||
|
||||
|
||||
# Install python dependencies
|
||||
echo ""
|
||||
echo -e "${YELLOW}Installing python dependencies${ENDCOLOR}"
|
||||
echo -e "${YELLOW}Installing project dependencies${ENDCOLOR}"
|
||||
echo ""
|
||||
poetry install -C /workspaces/forge/setup/ansible
|
||||
poetry install --no-root -C /workspaces/forge/setup/ansible
|
||||
|
||||
# Install ansible dependencies
|
||||
# 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
|
||||
# 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://containers.dev/guide/dependabot
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
schedule:
|
||||
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
|
||||
hostvars
|
||||
keygen
|
||||
LAZYGIT
|
||||
lineinfile
|
||||
minica
|
||||
Mountpoint
|
||||
|
|
Loading…
Reference in a new issue