Skip to content

Commit

Permalink
Merge pull request #347 from atheo89/pre-intall-ext
Browse files Browse the repository at this point in the history
Pre-install some extensions on code-server notebook
  • Loading branch information
harshad16 committed Dec 6, 2023
2 parents 9c3edfd + 0ffca51 commit 9e1ed7a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 deletions.
8 changes: 6 additions & 2 deletions codeserver/ubi9-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ WORKDIR /opt/app-root/bin
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
yum -y clean all --enablerepo='*'

# Change ownership of relevant directories
RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
fix-permissions /opt/app-root -P

# Install NGINX to proxy VSCode and pass probes check
ENV NGINX_VERSION=1.22 \
NGINX_SHORT_VER=122 \
Expand Down Expand Up @@ -78,8 +82,8 @@ COPY nginx/httpconf/ /opt/app-root/etc/nginx.d/
COPY nginx/api/ /opt/app-root/api/

# Launcher
COPY utils utils/
COPY run-code-server.sh run-nginx.sh ./
COPY --chown=1001:0 utils utils/
COPY --chown=1001:0 run-code-server.sh run-nginx.sh ./

ENV SHELL /bin/bash

Expand Down
25 changes: 25 additions & 0 deletions codeserver/ubi9-python-3.9/run-code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ fi
# Initilize access logs for culling
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/vscode.access.log

# Check if code-server exists
if [ ! -f "/opt/app-root/src/.local/share/code-server" ]; then

# Check internet connection
if curl -Is http://www.google.com | head -n 1 | grep -q "200 OK"; then
# Internet connection is available
echo "Internet connection available. Installing specific extensions."

# Install specific extensions
code-server --install-extension ${SCRIPT_DIR}/utils/ms-python.python-2023.14.0.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-2023.3.100.vsix
else
# No internet connection
echo "No internet connection. Installing all extensions."

# Install all extensions
code-server --install-extension ${SCRIPT_DIR}/utils/ms-python.python-2023.14.0.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-2023.3.100.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-keymap-1.1.2.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.jupyter-renderers-1.0.17.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.vscode-jupyter-cell-tags-0.1.8.vsix
code-server --install-extension ${SCRIPT_DIR}/utils/ms-toolsai.vscode-jupyter-slideshow-0.1.5.vsix
fi
fi

# Start server
start_process /usr/bin/code-server \
--bind-addr 0.0.0.0:8787 \
Expand Down
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 comments on commit 9e1ed7a

Please sign in to comment.