From 112b98da693c7ede8c9e30ef1b67a4ead22c5d0a Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 8 Nov 2023 18:23:55 +0000 Subject: [PATCH] chore(internal): improve github devcontainer setup --- .devcontainer/Dockerfile | 28 +++++----------------------- .devcontainer/devcontainer.json | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 73f1b9f237..6eb007253c 100644 --- a/.devcontainer/Dockerfile +++ b/.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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d55fc4d671..b9da964dc1 100644 --- a/.devcontainer/devcontainer.json +++ b/.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.