diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6f1dbd1..e8cd6c3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -16,6 +16,10 @@ ARG USERNAME=vscode ARG USER_UID=1000 ARG USER_GID=$USER_UID +ENV PIP_TARGET=/usr/local/share/pip-global +ENV PYTHONPATH=${PYTHONPATH}:${PIP_TARGET} +ENV PATH=${PATH}:${PIP_TARGET}/bin + # Uncomment the following COPY line and the corresponding lines in the `RUN` command if you wish to # include your requirements in the image itself. It is suggested that you only do this if your # requirements rarely (if ever) change. @@ -43,6 +47,10 @@ RUN apt-get update \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ && chmod 0440 /etc/sudoers.d/$USERNAME \ # + # Create alternate global install location that both uses have rights to access + && mkdir -p /usr/local/share/pip-global \ + && chown ${USERNAME}:root /usr/local/share/pip-global \ + # # Avoid having to use "sudo" with pip when running as non-root user && echo 'if [ "$(stat -c %U /usr/local/bin)" != "$(id -u)" ]; then \ sudo chown -R $(id -u):root /usr/local/lib/python*/site-packages \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9ed987f..6c73d57 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,7 +18,7 @@ "appPort": [ 9000 ], // Install flask and any other dependencies - "postCreateCommand": "sudo pip install -r requirements.txt", + "postCreateCommand": "pip install -r requirements.txt", // Comment out next line to run as root "remoteUser": "vscode",