From e602b7f604d61b54ba970caf8e865e629a8052de Mon Sep 17 00:00:00 2001 From: Michael Wood <32585282+michaeljwood@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:42:34 -0500 Subject: [PATCH 1/2] bug(devcontainer): Switch to bookworm based devcontainer image --- .devcontainer/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cd927eb6..28dd5662 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-alpine +FROM library/python:3.12-bookworm LABEL maintainer="CFPB RegTech Team" @@ -6,7 +6,7 @@ COPY pyproject.toml . COPY poetry.lock . # install git and alpine sdk for c compiler extensions -RUN apk add --update git curl +RUN apt update && apt install -y git curl # install pip dependencies RUN pip install --upgrade pip @@ -21,9 +21,9 @@ ARG USER=sbl ENV HOME /home/$USER # install sudo as root -RUN apk add --update sudo +RUN apt install sudo # add the new user -RUN adduser -D $USER \ +RUN adduser $USER \ && echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER \ && chmod 0440 /etc/sudoers.d/$USER From bb797abe2110a9638d4dc93d6b9cb8d7802586e2 Mon Sep 17 00:00:00 2001 From: Michael Wood <32585282+michaeljwood@users.noreply.github.com> Date: Tue, 4 Feb 2025 16:23:46 -0500 Subject: [PATCH 2/2] bug(devcontainer): Exclude .venv folder and run poetry install as a postCreateCommand. --- .devcontainer/Dockerfile | 4 ---- .devcontainer/devcontainer.json | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 28dd5662..63485dc3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,10 +12,6 @@ RUN apt update && apt install -y git curl RUN pip install --upgrade pip RUN pip install poetry -# run poetry install -RUN poetry config virtualenvs.create false -RUN poetry install --no-root - # create a non root sbl user ARG USER=sbl ENV HOME /home/$USER diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1dc2c1ad..d1ad3d65 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,6 +3,11 @@ "dockerfile": "Dockerfile", "context": ".." }, + "runArgs": [ + "--mount", + "type=volume,target=/${containerWorkspaceFolder}/.venv" + ], + "postCreateCommand": "poetry install", "customizations": { "vscode": { "extensions": [