diff --git a/.devcontainer/.dockerfilelintrc b/.devcontainer/.dockerfilelintrc new file mode 100644 index 0000000..782a730 --- /dev/null +++ b/.devcontainer/.dockerfilelintrc @@ -0,0 +1,2 @@ +rules: + sudo_usage: off diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..d1c4445 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +FROM python:3.12-slim + +# Install essential packages and create non-root user +RUN apt-get update && apt-get install -y --no-install-recommends git curl sudo bash-completion vim \ + && useradd -m -s /bin/bash vscode \ + && echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ + && mkdir -p /workspace \ + && chown vscode:vscode /workspace \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /workspace + +# Switch to non-root user +USER vscode + +# Set up shell completions +RUN echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc \ + && echo 'source /etc/bash_completion' >> ~/.bashrc + +# Set up uv and Python environment +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# Set up environment variables +ENV PATH="/home/vscode/.local/bin:${PATH}" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fd24ccd --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,43 @@ +{ + "name": "py-cppmodel Dev Container", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "esbenp.prettier-vscode", + "github.vscode-pull-request-github", + "ms-python.mypy-type-checker", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.vscode-jupyter-slideshow", + ], + "settings": { + "python.defaultInterpreterPath": "/${workspaceFolder}/.venv/bin/python", + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } + } + } + } + }, + "mounts": [ + "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" + ], + "remoteUser": "vscode", + "updateRemoteUserUID": true, + "remoteEnv": { + "UV_LINK_MODE": "copy" + } +}