From 6caa9df5083dcdedf90b2a854bab811cff0ac99b Mon Sep 17 00:00:00 2001 From: avouacr Date: Thu, 17 Feb 2022 11:45:27 +0000 Subject: [PATCH 1/8] activate conda env before entrypoint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8bace1c..3f8fd74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,4 +60,4 @@ RUN code-server --install-extension ms-azuretools.vscode-docker RUN code-server --install-extension njpwerner.autodocstring RUN code-server --install-extension redhat.vscode-yaml -RUN echo $PATH +ENTRYPOINT ["conda", "run", "-n", "basesspcloud", "/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] From fab26fc452016ce2d34510fb1ba48b73d92928d1 Mon Sep 17 00:00:00 2001 From: Romain Avouac <43444134+avouacr@users.noreply.github.com> Date: Thu, 17 Feb 2022 14:31:55 +0100 Subject: [PATCH 2/8] Update Dockerfile --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3f8fd74..96dcc3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,4 +60,8 @@ RUN code-server --install-extension ms-azuretools.vscode-docker RUN code-server --install-extension njpwerner.autodocstring RUN code-server --install-extension redhat.vscode-yaml -ENTRYPOINT ["conda", "run", "-n", "basesspcloud", "/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] +# Make RUN commands use the new conda env +SHELL ["conda", "run", "-n", "basesspcloud", "/bin/bash", "-c"] + +ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "basesspcloud", + "/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] From b17b8995bde01504bd0b1c48de6dddfbfa41a9a8 Mon Sep 17 00:00:00 2001 From: Romain Avouac <43444134+avouacr@users.noreply.github.com> Date: Thu, 17 Feb 2022 15:00:20 +0100 Subject: [PATCH 3/8] Update Dockerfile --- Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 96dcc3b..55c5509 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,9 @@ RUN cd /usr/bin && \ RUN sudo vault -autocomplete-install # INSTALL MINICONDA ------------------------------- +ARG CONDA_DIR=/home/coder/local/bin/conda RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /home/coder/local/bin/conda +RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p $CONDA_DIR RUN rm -f Miniconda3-latest-Linux-x86_64.sh # Install mamba (speed up packages install with conda) @@ -44,7 +45,11 @@ RUN conda install mamba -n base -c conda-forge RUN conda create -n basesspcloud python=$PYTHON_VERSION COPY environment.yml . RUN mamba env update -n basesspcloud -f environment.yml + +# Make basesspcloud env activated by default in shells ENV PATH="/home/coder/local/bin/conda/envs/basesspcloud/bin:${PATH}" +RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh" >> /home/coder/.bashrc +RUN echo "conda activate basesspcloud" >> /home/coder/.bashrc # Put additional VSCode settings in remote configuration RUN mkdir -p /home/coder/.local/share/code-server/Machine/ @@ -58,10 +63,4 @@ RUN code-server --install-extension ms-python.python RUN code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools RUN code-server --install-extension ms-azuretools.vscode-docker RUN code-server --install-extension njpwerner.autodocstring -RUN code-server --install-extension redhat.vscode-yaml - -# Make RUN commands use the new conda env -SHELL ["conda", "run", "-n", "basesspcloud", "/bin/bash", "-c"] - -ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "basesspcloud", - "/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] +RUN code-server --install-extension redhat.vscode-yaml From a94471607164a69c0d9ffbb38c3846e3090b01f3 Mon Sep 17 00:00:00 2001 From: Romain Avouac <43444134+avouacr@users.noreply.github.com> Date: Thu, 17 Feb 2022 15:31:21 +0100 Subject: [PATCH 4/8] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 55c5509..26a40b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ RUN mamba env update -n basesspcloud -f environment.yml # Make basesspcloud env activated by default in shells ENV PATH="/home/coder/local/bin/conda/envs/basesspcloud/bin:${PATH}" +RUN echo "export PATH=$PATH" # Temporary fix while PATH gets overwritten by code-server RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh" >> /home/coder/.bashrc RUN echo "conda activate basesspcloud" >> /home/coder/.bashrc From 5d28ac4d84dbe8d47194628966336dabe0ab90f0 Mon Sep 17 00:00:00 2001 From: Romain Avouac <43444134+avouacr@users.noreply.github.com> Date: Thu, 17 Feb 2022 16:06:23 +0100 Subject: [PATCH 5/8] Update settings.json --- settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.json b/settings.json index a4cc359..528585e 100644 --- a/settings.json +++ b/settings.json @@ -1,4 +1,4 @@ { "workbench.colorTheme": "Default Dark+", - "python.defaultInterpreterPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python" -} \ No newline at end of file + "python.pythonPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python" +} From ba8260f3ade9ada6d6dcc8282294a9ba497d6d7d Mon Sep 17 00:00:00 2001 From: avouacr Date: Thu, 17 Feb 2022 15:53:14 +0000 Subject: [PATCH 6/8] fix pythonPath --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 26a40b1..0e5b21f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ RUN echo "export PATH=$PATH" # Temporary fix while PATH gets overwritten by cod RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh" >> /home/coder/.bashrc RUN echo "conda activate basesspcloud" >> /home/coder/.bashrc -# Put additional VSCode settings in remote configuration +# Additional VSCode settings RUN mkdir -p /home/coder/.local/share/code-server/Machine/ COPY settings.json /home/coder/.local/share/code-server/Machine/settings.json From 609fcb8af9e1563e04a0a2b45c3912ca81210326 Mon Sep 17 00:00:00 2001 From: avouacr Date: Thu, 17 Feb 2022 16:16:16 +0000 Subject: [PATCH 7/8] fix default interpreter --- Dockerfile | 4 +--- settings.json | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e5b21f..8b3ccee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,12 +53,10 @@ RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh" >> /home/coder/.bashrc RUN echo "conda activate basesspcloud" >> /home/coder/.bashrc # Additional VSCode settings +# Put in remote settings because : https://github.com/coder/code-server/issues/4609 RUN mkdir -p /home/coder/.local/share/code-server/Machine/ COPY settings.json /home/coder/.local/share/code-server/Machine/settings.json -# Nice colors in python terminal -RUN echo "import sys ; from IPython.core.ultratb import ColorTB ; sys.excepthook = ColorTB() ;" >> /home/coder/local/bin/conda/envs/basesspcloud/lib/python${PYTHON_VERSION}/site-packages/sitecustomize.py - # INSTALL VSTUDIO EXTENSIONS RUN code-server --install-extension ms-python.python RUN code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools diff --git a/settings.json b/settings.json index 528585e..c0700e4 100644 --- a/settings.json +++ b/settings.json @@ -1,4 +1,5 @@ { "workbench.colorTheme": "Default Dark+", - "python.pythonPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python" + "python.pythonPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python", + "python.defaultInterpreterPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python" } From 30ecb4904f65344daed2ca701ae67763e768db1b Mon Sep 17 00:00:00 2001 From: avouacr Date: Thu, 17 Feb 2022 17:10:08 +0000 Subject: [PATCH 8/8] don't activate conda env in shell --- Dockerfile | 4 +--- settings.json | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b3ccee..b8e19ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,9 +48,7 @@ RUN mamba env update -n basesspcloud -f environment.yml # Make basesspcloud env activated by default in shells ENV PATH="/home/coder/local/bin/conda/envs/basesspcloud/bin:${PATH}" -RUN echo "export PATH=$PATH" # Temporary fix while PATH gets overwritten by code-server -RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh" >> /home/coder/.bashrc -RUN echo "conda activate basesspcloud" >> /home/coder/.bashrc +RUN echo "export PATH=$PATH" >> /home/coder/.bashrc # Temporary fix while PATH gets overwritten by code-server # Additional VSCode settings # Put in remote settings because : https://github.com/coder/code-server/issues/4609 diff --git a/settings.json b/settings.json index c0700e4..5a6dbe4 100644 --- a/settings.json +++ b/settings.json @@ -1,5 +1,6 @@ { "workbench.colorTheme": "Default Dark+", "python.pythonPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python", - "python.defaultInterpreterPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python" + "python.defaultInterpreterPath": "/home/coder/local/bin/conda/envs/basesspcloud/bin/python", + "terminal.integrated.inheritEnv": false }