Skip to content

Commit 9d73789

Browse files
committed
fixes start command, adds logging, removes useradd in prod Docker
1 parent 14e0c51 commit 9d73789

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

template/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
FROM python:3.10.14
22

3+
ENV HOME=/home/user
4+
35
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
46
build-essential curl git util-linux jq sudo nodejs npm fonts-noto-cjk
57

6-
RUN mkdir -p /home/user/.jupyter /home/user/.ipython /home/user/.server
8+
RUN mkdir -p $HOME/.jupyter $HOME/.ipython $HOME/.server
79

810
ENV PIP_DEFAULT_TIMEOUT=100 \
911
PIP_DISABLE_PIP_VERSION_CHECK=1 \
1012
PIP_NO_CACHE_DIR=1 \
11-
JUPYTER_CONFIG_PATH="/home/user/.jupyter" \
12-
IPYTHON_CONFIG_PATH="/home/user/.ipython" \
13-
SERVER_PATH="/home/user/.server" \
13+
JUPYTER_CONFIG_PATH="$HOME/.jupyter" \
14+
IPYTHON_CONFIG_PATH="$HOME/.ipython" \
15+
SERVER_PATH="$HOME/.server" \
1416
R_VERSION=4.4.2
1517

1618
ENV R_HOME=/opt/R/${R_VERSION} \
@@ -34,7 +36,7 @@ RUN ijsinstall --install=global
3436
COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno
3537
RUN chmod +x /usr/bin/deno
3638
RUN deno jupyter --unstable --install
37-
COPY ./deno.json /home/user/.local/share/jupyter/kernels/deno/kernel.json
39+
COPY ./deno.json $HOME/.local/share/jupyter/kernels/deno/kernel.json
3840

3941
# Bash Kernel
4042
RUN pip install bash_kernel
@@ -49,7 +51,7 @@ RUN $SERVER_PATH/.venv/bin/pip install --no-cache-dir -r $SERVER_PATH/requiremen
4951
COPY ./server $SERVER_PATH
5052

5153
# Copy matplotlibrc
52-
COPY matplotlibrc /home/user/.config/matplotlib/.matplotlibrc
54+
COPY matplotlibrc $HOME/.config/matplotlib/matplotlibrc
5355

5456
# Copy Jupyter configuration
5557
COPY ./start-up.sh $JUPYTER_CONFIG_PATH/
@@ -63,7 +65,6 @@ COPY ipython_kernel_config.py $IPYTHON_CONFIG_PATH/profile_default/
6365
RUN mkdir -p $IPYTHON_CONFIG_PATH/profile_default/startup
6466
COPY startup_scripts/* $IPYTHON_CONFIG_PATH/profile_default/startup
6567

66-
6768
COPY --from=eclipse-temurin:11-jdk $JAVA_HOME $JAVA_HOME
6869
RUN ln -s ${JAVA_HOME}/bin/java /usr/bin/java
6970

template/e2b.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
team_id = "400a4584-3d22-4b70-82ee-0bc6cce4aaa5"
1414
memory_mb = 1_024
15-
start_cmd = "/home/user/.jupyter/start-up.sh"
15+
start_cmd = "sudo -u user /home/user/.jupyter/start-up.sh"
1616
dockerfile = "Dockerfile"
1717
template_id = "8cvk102nkxqyd5l3kelv"

template/start-up.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function start_jupyter_server() {
2626
echo "${response}" > /home/user/.jupyter/.session_info
2727

2828
cd /home/user/.server/
29-
/home/user/.server/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 49999 --workers 1 --no-access-log --no-use-colors
29+
/home/user/.server/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 49999 --workers 1 --no-access-log --no-use-colors >> /home/user/uvicorn_server.log 2>&1
3030
}
3131

3232
echo "Starting Code Interpreter server..."
3333
start_jupyter_server &
34-
MATPLOTLIBRC=/home/user/.config/matplotlib/.matplotlibrc jupyter server --IdentityProvider.token="" >/dev/null 2>&1
34+
MATPLOTLIBRC=/home/user/.config/matplotlib/.matplotlibrc jupyter server --IdentityProvider.token="" >> /home/user/jupyter_server.log 2>&1

0 commit comments

Comments
 (0)