From e4e37d4ba28fe9b169e3a0deeecdc222f81b134e Mon Sep 17 00:00:00 2001 From: "Jonathan B. Coe" Date: Sun, 8 Feb 2026 00:47:17 +0000 Subject: [PATCH] Add a devcontainer for easy debugging of Linux issues See: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers --- .devcontainer/Dockerfile | 33 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..41efd8337 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +FROM python:3.12-slim + +# Install essential packages +RUN apt-get update && apt-get install -yq \ + apt-transport-https \ + bash-completion \ + bison \ + build-essential \ + curl \ + flex \ + git \ + libbz2-dev \ + ninja-build \ + sudo \ + vim + +# Create non-root user +RUN 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 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 000000000..bab4e9af6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "name": "Nethack Learning Environment Dev Container", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "ms-python.python", + "ms-python.vscode-pylance" + ], + "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" + } +}