Ramses II
commited on
Commit
·
31004c5
1
Parent(s):
da5c857
auto msg
Browse files- Dockerfile +2 -1
- entrypoint.sh +7 -8
Dockerfile
CHANGED
@@ -68,6 +68,7 @@ EXPOSE 7860
|
|
68 |
# Set the environment variables
|
69 |
ENV JUPYTERLAB_PORT=8888
|
70 |
ENV NGINX_PORT=7860
|
|
|
71 |
|
72 |
# Run the entrypoint script when the container starts
|
73 |
-
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
68 |
# Set the environment variables
|
69 |
ENV JUPYTERLAB_PORT=8888
|
70 |
ENV NGINX_PORT=7860
|
71 |
+
ENV JUPYTER_TOKEN=""
|
72 |
|
73 |
# Run the entrypoint script when the container starts
|
74 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|
entrypoint.sh
CHANGED
@@ -20,12 +20,11 @@ fi
|
|
20 |
# Asegurar que el usuario jovyan sea el propietario de /data
|
21 |
chown -R ${NB_UID}:${NB_GID} /data
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
handle_error "El token de JupyterLab está vacío"
|
29 |
fi
|
30 |
|
31 |
# Verificar disponibilidad de GPU
|
@@ -39,7 +38,7 @@ fi
|
|
39 |
|
40 |
# Iniciar JupyterLab en segundo plano
|
41 |
jupyter lab --ip=0.0.0.0 --port=${JUPYTERLAB_PORT} --no-browser --allow-root \
|
42 |
-
--NotebookApp.base_url=/jupyter --NotebookApp.token=${
|
43 |
--notebook-dir=/data &
|
44 |
|
45 |
# Asegurar que el archivo PID de Nginx sea escribible
|
@@ -47,4 +46,4 @@ touch /tmp/nginx.pid
|
|
47 |
chmod 644 /tmp/nginx.pid
|
48 |
|
49 |
# Iniciar Nginx en primer plano
|
50 |
-
nginx -g "daemon off;" -c /etc/nginx/nginx.conf || handle_error "Fallo al iniciar Nginx"
|
|
|
20 |
# Asegurar que el usuario jovyan sea el propietario de /data
|
21 |
chown -R ${NB_UID}:${NB_GID} /data
|
22 |
|
23 |
+
# Verificar si el secreto JUPYTER_TOKEN existe y asignarlo a la variable de entorno
|
24 |
+
if [ -f "/run/secrets/JUPYTER_TOKEN" ]; then
|
25 |
+
export JUPYTER_TOKEN=$(cat /run/secrets/JUPYTER_TOKEN)
|
26 |
+
elif [ -z "$JUPYTER_TOKEN" ]; then
|
27 |
+
handle_error "El token de JupyterLab está vacío. Asegúrate de configurar el secreto JUPYTER_TOKEN en la configuración del Space."
|
|
|
28 |
fi
|
29 |
|
30 |
# Verificar disponibilidad de GPU
|
|
|
38 |
|
39 |
# Iniciar JupyterLab en segundo plano
|
40 |
jupyter lab --ip=0.0.0.0 --port=${JUPYTERLAB_PORT} --no-browser --allow-root \
|
41 |
+
--NotebookApp.base_url=/jupyter --NotebookApp.token=${JUPYTER_TOKEN} \
|
42 |
--notebook-dir=/data &
|
43 |
|
44 |
# Asegurar que el archivo PID de Nginx sea escribible
|
|
|
46 |
chmod 644 /tmp/nginx.pid
|
47 |
|
48 |
# Iniciar Nginx en primer plano
|
49 |
+
nginx -g "daemon off;" -c /etc/nginx/nginx.conf || handle_error "Fallo al iniciar Nginx"
|