feat: changed to neovim based development, removed root remote user

This commit is contained in:
2026-08-25 13:36:19 +02:00
parent 4361a7fdd9
commit 978052b430
2 changed files with 58 additions and 13 deletions
+42 -4
View File
@@ -1,5 +1,43 @@
FROM python:3.14-slim FROM python:3.14-slim
# Instalar git y herramientas básicas
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/* ARG USERNAME=dev
# Instalar Poetry ARG USER_UID=1000
RUN pip install poetry ARG USER_GID=1000
# Herramientas básicas + zsh + utilidades que usará neovim (ripgrep/fd para telescope, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
zsh \
sudo \
ripgrep \
fd-find \
unzip \
build-essential \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Debian llama al binario "fdfind" en vez de "fd": creamos un enlace para que
# los plugins de neovim que esperan "fd" lo encuentren.
RUN ln -s $(which fdfind) /usr/local/bin/fd
# Crear grupo y usuario "dev" con UID:GID 1000:1000 (evita problemas de
# permisos con los bind mounts del host) y darle sudo sin contraseña.
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m -s /bin/zsh ${USERNAME} \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
# Poetry a nivel de sistema (como root) para que quede disponible en el PATH
# de cualquier usuario y no se pierda al cambiar de shell.
RUN pip install --no-cache-dir poetry \
&& poetry config virtualenvs.in-project true
# A partir de aquí trabajamos como el usuario "dev", igual que se hace con
# "ubuntu" en el ejemplo de esp-idf, para instalar oh-my-zsh en su propio HOME.
USER ${USERNAME}
WORKDIR /home/${USERNAME}
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
WORKDIR /workspace
+16 -9
View File
@@ -1,7 +1,17 @@
{ {
"name": "Python Poetry Dev", "name": "Python Poetry Dev",
"build": { "build": {
"dockerfile": "Dockerfile" "dockerfile": "Dockerfile",
"args": {
"USERNAME": "dev",
"USER_UID": "1000",
"USER_GID": "1000"
}
},
"features": {
"ghcr.io/duduribeiro/devcontainer-features/neovim:1": {
"version": "stable"
}
}, },
"customizations": { "customizations": {
"vscode": { "vscode": {
@@ -22,17 +32,14 @@
} }
} }
}, },
"runArgs": [ "runArgs": ["--privileged", "-v", "/dev:/dev"],
"--privileged",
"-v",
"/dev:/dev"
],
"mounts": [ "mounts": [
"source=${localEnv:XDG_RUNTIME_DIR}/ssh-agent.socket,target=/tmp/ssh-agent.socket,type=bind" "source=${localEnv:XDG_RUNTIME_DIR}/ssh-agent.socket,target=/tmp/ssh-agent.socket,type=bind",
"source=${env:HOME}/.config/nvim,target=/home/dev/.config/nvim,type=bind"
], ],
"remoteEnv": { "remoteEnv": {
"SSH_AUTH_SOCK": "/tmp/ssh-agent.socket" "SSH_AUTH_SOCK": "/tmp/ssh-agent.socket"
}, },
"remoteUser": "root", "remoteUser": "dev",
"postCreateCommand": "poetry install" "postCreateCommand": "poetry install"
} }