Ramses II
commited on
Commit
·
96dcb2f
1
Parent(s):
b26378c
auto msg
Browse files- Dockerfile +0 -1
- README.md +19 -6
- entrypoint.sh +4 -1
- jupyter_config.py +4 -1
Dockerfile
CHANGED
@@ -51,7 +51,6 @@ EXPOSE 7860
|
|
51 |
|
52 |
# Set the environment variables
|
53 |
ENV JUPYTERLAB_PORT=8888
|
54 |
-
ENV JUPYTERLAB_TOKEN=your_secret_token
|
55 |
ENV NGINX_PORT=7860
|
56 |
|
57 |
# Run the entrypoint script when the container starts
|
|
|
51 |
|
52 |
# Set the environment variables
|
53 |
ENV JUPYTERLAB_PORT=8888
|
|
|
54 |
ENV NGINX_PORT=7860
|
55 |
|
56 |
# Run the entrypoint script when the container starts
|
README.md
CHANGED
@@ -1,11 +1,24 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
-
license: mit
|
9 |
---
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: JupyterLab con Nginx y contenido estático
|
3 |
+
emoji: 📊
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: red
|
6 |
sdk: docker
|
7 |
pinned: false
|
|
|
8 |
---
|
9 |
|
10 |
+
# JupyterLab con Nginx y contenido estático
|
11 |
+
|
12 |
+
Este espacio proporciona un entorno JupyterLab protegido con un token, servido a través de Nginx junto con contenido estático.
|
13 |
+
|
14 |
+
## Configuración
|
15 |
+
|
16 |
+
Este espacio utiliza un secreto para proteger el acceso a JupyterLab. Asegúrate de configurar el siguiente secreto en la configuración del espacio:
|
17 |
+
|
18 |
+
- `JUPYTER_TOKEN`: Token de acceso para JupyterLab
|
19 |
+
|
20 |
+
## Uso
|
21 |
+
|
22 |
+
- El contenido estático se sirve en la raíz `/`
|
23 |
+
- JupyterLab está disponible en `/jupyter/`
|
24 |
+
- Utiliza el token configurado en el secreto `JUPYTER_TOKEN` para acceder a JupyterLab
|
entrypoint.sh
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
#!/bin/bash
|
2 |
|
|
|
|
|
|
|
3 |
# Start JupyterLab in the background
|
4 |
-
jupyter lab --ip=0.0.0.0 --port=${JUPYTERLAB_PORT} --no-browser --allow-root --NotebookApp.base_url=/jupyter &
|
5 |
|
6 |
# Ensure the Nginx PID file is writable
|
7 |
touch /tmp/nginx.pid
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
# Read the JupyterLab token from the HF secret
|
4 |
+
JUPYTERLAB_TOKEN=$(cat /run/secrets/JUPYTER_TOKEN)
|
5 |
+
|
6 |
# Start JupyterLab in the background
|
7 |
+
jupyter lab --ip=0.0.0.0 --port=${JUPYTERLAB_PORT} --no-browser --allow-root --NotebookApp.base_url=/jupyter --NotebookApp.token=${JUPYTERLAB_TOKEN} &
|
8 |
|
9 |
# Ensure the Nginx PID file is writable
|
10 |
touch /tmp/nginx.pid
|
jupyter_config.py
CHANGED
@@ -1,5 +1,8 @@
|
|
|
|
|
|
1 |
c.NotebookApp.ip = '0.0.0.0'
|
2 |
c.NotebookApp.port = 8888
|
3 |
c.NotebookApp.open_browser = False
|
4 |
c.NotebookApp.allow_root = True
|
5 |
-
c.NotebookApp.
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
c.NotebookApp.ip = '0.0.0.0'
|
4 |
c.NotebookApp.port = 8888
|
5 |
c.NotebookApp.open_browser = False
|
6 |
c.NotebookApp.allow_root = True
|
7 |
+
c.NotebookApp.base_url = '/jupyter'
|
8 |
+
c.NotebookApp.token = os.environ.get('JUPYTERLAB_TOKEN', '')
|