Commit ebdcc3f5

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2023-11-09 02:23:59
chore(internal): improve github devcontainer setup (#737)
1 parent ba42447
Changed files (2)
.devcontainer/devcontainer.json
@@ -3,7 +3,26 @@
 {
   "name": "Debian",
   "build": {
-    "dockerfile": "Dockerfile"
+    "dockerfile": "Dockerfile",
+    "context": ".."
+  },
+
+  "postStartCommand": "rye sync --all-features",
+
+  "customizations": {
+    "vscode": {
+      "extensions": [
+        "ms-python.python"
+      ],
+      "settings": { 
+        "terminal.integrated.shell.linux": "/bin/bash",
+        "python.pythonPath": ".venv/bin/python",
+        "python.typeChecking": "basic",
+        "terminal.integrated.env.linux": {
+          "PATH": "/home/vscode/.rye/shims:${env:PATH}"
+        }
+      }
+    }
   }
 
   // Features to add to the dev container. More info: https://containers.dev/features.
.devcontainer/Dockerfile
@@ -1,27 +1,9 @@
-# syntax=docker/dockerfile:1
-FROM debian:bookworm-slim
+ARG VARIANT="3.9"
+FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
 
-RUN apt-get update && apt-get install -y \
-  libxkbcommon0 \
-  ca-certificates \
-  make \
-  curl \
-  git \
-  unzip \
-  libc++1 \
-  vim \
-  termcap \
-  && apt-get clean autoclean
+USER vscode
 
 RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.15.2" RYE_INSTALL_OPTION="--yes" bash
-ENV PATH=/root/.rye/shims:$PATH
+ENV PATH=/home/vscode/.rye/shims:$PATH
 
-WORKDIR /workspace
-
-COPY README.md .python-version pyproject.toml requirements.lock requirements-dev.lock /workspace/
-
-RUN rye sync --all-features
-
-COPY . /workspace
-
-CMD ["rye", "shell"]
+RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc