Skip to content

Commit 9e1ed7a

Browse files
authored
Merge pull request #347 from atheo89/pre-intall-ext
Pre-install some extensions on code-server notebook
2 parents 9c3edfd + 0ffca51 commit 9e1ed7a

8 files changed

+31
-2
lines changed

codeserver/ubi9-python-3.9/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ WORKDIR /opt/app-root/bin
2121
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
2222
yum -y clean all --enablerepo='*'
2323

24+
# Change ownership of relevant directories
25+
RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
26+
fix-permissions /opt/app-root -P
27+
2428
# Install NGINX to proxy VSCode and pass probes check
2529
ENV NGINX_VERSION=1.22 \
2630
NGINX_SHORT_VER=122 \
@@ -78,8 +82,8 @@ COPY nginx/httpconf/ /opt/app-root/etc/nginx.d/
7882
COPY nginx/api/ /opt/app-root/api/
7983

8084
# Launcher
81-
COPY utils utils/
82-
COPY run-code-server.sh run-nginx.sh ./
85+
COPY --chown=1001:0 utils utils/
86+
COPY --chown=1001:0 run-code-server.sh run-nginx.sh ./
8387

8488
ENV SHELL /bin/bash
8589

codeserver/ubi9-python-3.9/run-code-server.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ fi
1616
# Initilize access logs for culling
1717
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/vscode.access.log
1818

19+
# Check if code-server exists
20+
if [ ! -f "/opt/app-root/src/.local/share/code-server" ]; then
21+
22+
# Check internet connection
23+
if curl -Is http://www.google.com | head -n 1 | grep -q "200 OK"; then
24+
# Internet connection is available
25+
echo "Internet connection available. Installing specific extensions."
26+
27+
# Install specific extensions
28+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-python.python-2023.14.0.vsix
29+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-2023.3.100.vsix
30+
else
31+
# No internet connection
32+
echo "No internet connection. Installing all extensions."
33+
34+
# Install all extensions
35+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-python.python-2023.14.0.vsix
36+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-2023.3.100.vsix
37+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-keymap-1.1.2.vsix
38+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-renderers-1.0.17.vsix
39+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.vscode-jupyter-cell-tags-0.1.8.vsix
40+
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.vscode-jupyter-slideshow-0.1.5.vsix
41+
fi
42+
fi
43+
1944
# Start server
2045
start_process /usr/bin/code-server \
2146
--bind-addr 0.0.0.0:8787 \
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)