-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: vscode 4.8
- Loading branch information
Showing
12 changed files
with
306 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
FROM saagie/python:3.9-1.109.0 AS PYTHON39 | ||
FROM saagie/vscode-server:4.8 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -qqy --no-install-recommends \ | ||
wget \ | ||
gcc \ | ||
g++ \ | ||
libsasl2-2 \ | ||
libsasl2-modules-ldap \ | ||
build-essential \ | ||
unixodbc \ | ||
unixodbc-dev \ | ||
libpq-dev \ | ||
libsqlite3-dev \ | ||
libkrb5-dev \ | ||
libsasl2-dev \ | ||
libssl-dev \ | ||
libcurl4-openssl-dev \ | ||
libgeos-dev \ | ||
swig \ | ||
python3-matplotlib \ | ||
python3-lxml \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/ | ||
|
||
ARG NB_UID="1000" | ||
ARG NB_GID="100" | ||
|
||
ENV CONDA_DIR=/opt/conda \ | ||
SHELL=/bin/bash \ | ||
NB_UID=${NB_UID} \ | ||
NB_GID=${NB_GID} \ | ||
LC_ALL=en_US.UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
LANGUAGE=en_US.UTF-8 | ||
ENV PATH="${CONDA_DIR}/bin:${PATH}" | ||
|
||
# Install miniforge | ||
ARG CONDA_MIRROR=https://github.com/conda-forge/miniforge/releases/latest/download | ||
|
||
# ---- Miniforge installer ---- | ||
# Check https://github.com/conda-forge/miniforge/releases | ||
# Package Manager and Python implementation to use (https://github.com/conda-forge/miniforge) | ||
# We're using Mambaforge installer, possible options: | ||
# - conda only: either Miniforge3 to use Python or Miniforge-pypy3 to use PyPy | ||
# - conda + mamba: either Mambaforge to use Python or Mambaforge-pypy3 to use PyPy | ||
# Installation: conda, mamba, pip | ||
RUN set -x && \ | ||
# Miniforge installer | ||
miniforge_arch=$(uname -m) && \ | ||
miniforge_installer="Mambaforge-Linux-${miniforge_arch}.sh" && \ | ||
wget --quiet "${CONDA_MIRROR}/${miniforge_installer}" && \ | ||
/bin/bash "${miniforge_installer}" -f -b -p "${CONDA_DIR}" && \ | ||
rm "${miniforge_installer}" && \ | ||
# Conda configuration see https://conda.io/projects/conda/en/latest/configuration.html | ||
conda config --system --set auto_update_conda false && \ | ||
conda config --system --set show_channel_urls true && \ | ||
if [[ "${PYTHON_VERSION}" != "default" ]]; then mamba install --quiet --yes python="${PYTHON_VERSION}"; fi && \ | ||
# Pin major.minor version of python | ||
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \ | ||
# Using conda to update all packages: https://github.com/mamba-org/mamba/issues/1092 | ||
conda update --all --quiet --yes && \ | ||
conda clean --all -f -y && \ | ||
fix-permissions "${CONDA_DIR}" | ||
|
||
# Create 3 conda envs | ||
RUN conda create -n py38 python=3.8.12 \ | ||
&& bash -c "source activate py38 && conda install notebook ipykernel -y && ipython kernel install --user --name py38 --display-name 'Python 3.8'" \ | ||
&& conda create -n py39 python=3.9.10 \ | ||
&& bash -c "source activate py39 && conda install notebook ipykernel -y && ipython kernel install --user --name py39 --display-name 'Python 3.9'" \ | ||
&& conda create -n py310 python=3.10.2 \ | ||
&& bash -c "source activate py310 && conda install notebook ipykernel -y && ipython kernel install --user --name py310 --display-name 'Python 3.10'" \ | ||
&& conda clean -ay \ | ||
&& rm -rf ~/.cache/pip \ | ||
&& fix-permissions "${CONDA_DIR}" | ||
|
||
# Get requirements from Saagie Python image | ||
COPY --from=PYTHON39 /tmp/requirements.txt /tmp/requirements.txt | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Install requirements from Saagie Python image | ||
RUN sh -x \ | ||
&& for env in py38 py39 py310; \ | ||
do \ | ||
. activate $env \ | ||
&& python -m pip install --no-cache-dir -r /tmp/requirements.txt \ | ||
&& conda deactivate; \ | ||
done \ | ||
&& conda clean -ay \ | ||
&& rm -rf ~/.cache/pip \ | ||
&& fix-permissions "${CONDA_DIR}" | ||
|
||
|
||
# Install Vscode Python extension | ||
RUN /app/code-server/bin/code-server --extensions-dir /config/extensions/ --install-extension ms-python.python | ||
|
||
# # # Change settings to run interactive code in jupyter | ||
# COPY resources/* /config/data/User/ | ||
RUN rm /tmp/settings/settings.json | ||
COPY resources/* /tmp/settings/ | ||
|
||
ENV CONDA_DEFAULT_ENV=py310 | ||
|
||
# Setup user env and prefix environment variables with VSCODE_ | ||
RUN conda init bash \ | ||
&& echo "conda activate py310" >> ~/.bashrc \ | ||
&& sed -i '2s|^|\ | ||
mkdir -p /config/workspace/.vscode \n \ | ||
cp -u /tmp/settings/project-settings.json /config/workspace/.vscode/settings.json \n \ | ||
|' /etc/s6-overlay/s6-rc.d/svc-code-server/run |
3 changes: 3 additions & 0 deletions
3
technologies/app/vscode/vscode-4.8-python/resources/project-settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.defaultInterpreterPath": "/opt/conda/envs/py310/bin/python" | ||
} |
7 changes: 7 additions & 0 deletions
7
technologies/app/vscode/vscode-4.8-python/resources/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"jupyter.sendSelectionToInteractiveWindow": true, | ||
"jupyter.alwaysScrollOnNewCell": true, | ||
"jupyter.askForKernelRestart": false, | ||
"interactiveWindow.collapseCellInputCode": "never", | ||
"workbench.colorTheme": "Default Dark+" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM ghcr.io/linuxserver/code-server:4.8.3 | ||
|
||
USER root | ||
|
||
ENV PUID=1000 | ||
ENV PGID=1000 | ||
RUN TZ=Europe/London | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y nginx \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/ \ | ||
&& rm /etc/nginx/sites-enabled/default | ||
|
||
COPY resources/nginx.conf /etc/nginx/sites-enabled/nginx.conf | ||
COPY resources/entrypoint.sh /entrypoint.sh | ||
|
||
RUN chmod +x /entrypoint.sh \ | ||
&& chmod +x /etc/nginx/sites-enabled/nginx.conf | ||
|
||
# Copy a script that we will use to correct permissions after running certain commands | ||
COPY resources/fix-permissions /usr/local/bin/fix-permissions | ||
RUN chmod a+rx /usr/local/bin/fix-permissions | ||
|
||
RUN mkdir -p /tmp/settings | ||
COPY resources/settings.json /tmp/settings/ | ||
|
||
RUN sed -i 's/SUDO_PASSWORD/VSCODE_SUDO_PASSWORD/g' /etc/s6-overlay/s6-rc.d/init-code-server/run \ | ||
&& sed -i '2s|^|\ | ||
export PASSWORD=$VSCODE_PASSWORD \n \ | ||
export HASHED_PASSWORD=$VSCODE_HASHED_PASSWORD \n \ | ||
mkdir -p /config/data/User/ \n \ | ||
cp -u /tmp/settings/settings.json /config/data/User/ \n \ | ||
fix-permissions /config/ \n \ | ||
|' /etc/s6-overlay/s6-rc.d/svc-code-server/run | ||
|
||
COPY resources/nginx-run /etc/services.d/nginx/run | ||
|
||
EXPOSE 8443 | ||
|
||
# Use s6-overlay as entrypoint to run multiple processes | ||
ENTRYPOINT ["/init"] |
14 changes: 14 additions & 0 deletions
14
technologies/app/vscode/vscode-4.8/resources/entrypoint.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
echo "Set Proxy" | ||
export PROXY_DOMAIN=$SAAGIE_BASE_PATH | ||
|
||
echo "SAAGIE_BASE_PATH" | ||
echo $SAAGIE_BASE_PATH | ||
echo "PROXY_DOMAIN" | ||
echo $PROXY_DOMAIN | ||
|
||
# /init | ||
|
||
sed -i 's:SAAGIE_BASE_PATH:'"$SAAGIE_BASE_PATH"':g' /etc/nginx/sites-enabled/nginx.conf | ||
|
||
/init |
35 changes: 35 additions & 0 deletions
35
technologies/app/vscode/vscode-4.8/resources/fix-permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# set permissions on a directory | ||
# after any installation, if a directory needs to be (human) user-writable, | ||
# run this script on it. | ||
# It will make everything in the directory owned by the group ${NB_GID} | ||
# and writable by that group. | ||
# Deployments that want to set a specific user id can preserve permissions | ||
# by adding the `--group-add users` line to `docker run`. | ||
|
||
# uses find to avoid touching files that already have the right permissions, | ||
# which would cause massive image explosion | ||
|
||
# right permissions are: | ||
# group=${NB_GID} | ||
# AND permissions include group rwX (directory-execute) | ||
# AND directories have setuid,setgid bits set | ||
|
||
set -e | ||
|
||
for d in "$@"; do | ||
find "${d}" \ | ||
! \( \ | ||
-group "${NB_GID}" \ | ||
-a -perm -g+rwX \ | ||
\) \ | ||
-exec chgrp "${NB_GID}" {} \; \ | ||
-exec chmod g+rwX {} \; | ||
# setuid, setgid *on directories only* | ||
find "${d}" \ | ||
\( \ | ||
-type d \ | ||
-a ! -perm -6000 \ | ||
\) \ | ||
-exec chmod +6000 {} \; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
echo "Set Proxy" | ||
export PROXY_DOMAIN=$SAAGIE_BASE_PATH | ||
|
||
echo "SAAGIE_BASE_PATH" | ||
echo $SAAGIE_BASE_PATH | ||
echo "PROXY_DOMAIN" | ||
echo $PROXY_DOMAIN | ||
|
||
sed -i 's:SAAGIE_BASE_PATH:'"$SAAGIE_BASE_PATH"':g' /etc/nginx/sites-enabled/nginx.conf | ||
|
||
nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
map $http_connection $upgrade_requested { | ||
default upgrade; | ||
'' close; | ||
} | ||
server { | ||
listen 80 default_server; | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
location SAAGIE_BASE_PATH { | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $upgrade_requested; | ||
# proxy_set_header Accept-Encoding "" | ||
proxy_read_timeout 20d; | ||
|
||
rewrite ^SAAGIE_BASE_PATH/(.*)$ /$1 break; | ||
rewrite ^SAAGIE_BASE_PATH$ / break; | ||
|
||
proxy_pass http://localhost:8443; | ||
|
||
proxy_redirect http://localhost:8443/ $scheme://$hostSAAGIE_BASE_PATH/; | ||
proxy_redirect https://localhost:8443/ $scheme://$hostSAAGIE_BASE_PATH/; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"workbench.colorTheme": "Default Dark+" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
version.buildmeta= | ||
version.buildmeta=feature/vscode-4.8 | ||
version.major=0 | ||
version.minor=73 | ||
version.patch=0 | ||
version.prerelease= | ||
version.semver=0.73.0 | ||
version.prerelease=BETA | ||
version.semver=0.73.0-BETA+feature/vscode-4.8 |