Template
feat: changed to neovim based development, removed root remote user
This commit is contained in:
@@ -1,5 +1,43 @@
|
||||
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/*
|
||||
# Instalar Poetry
|
||||
RUN pip install poetry
|
||||
|
||||
ARG USERNAME=dev
|
||||
ARG USER_UID=1000
|
||||
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
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
{
|
||||
"name": "Python Poetry Dev",
|
||||
"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": {
|
||||
"vscode": {
|
||||
@@ -22,17 +32,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"runArgs": [
|
||||
"--privileged",
|
||||
"-v",
|
||||
"/dev:/dev"
|
||||
],
|
||||
"runArgs": ["--privileged", "-v", "/dev:/dev"],
|
||||
"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": {
|
||||
"SSH_AUTH_SOCK": "/tmp/ssh-agent.socket"
|
||||
},
|
||||
"remoteUser": "root",
|
||||
"remoteUser": "dev",
|
||||
"postCreateCommand": "poetry install"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user