-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (41 loc) · 1.53 KB
/
Dockerfile
File metadata and controls
49 lines (41 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# ===== Imagen base del curso =====
FROM public.ecr.aws/deeplearning-ai/public-courses:base-python3.11-v6
# Carpeta de trabajo dentro del contenedor
WORKDIR /home/jovyan/work
# Usamos root para instalar paquetes
USER root
# ===== Copiar TODO el contenido que la plataforma pone en works/ =====
# (notebook, html, requirements, etc. si existen)
COPY works /home/jovyan/work
# ===== Instalar dependencias si existe requirements.txt =====
RUN if [ -f /home/jovyan/work/requirements.txt ]; then \
echo "Found requirements.txt, installing..." && \
pip3 install -r /home/jovyan/work/requirements.txt && \
pip3 cache purge ; \
else \
echo "No requirements.txt found in /home/jovyan/work, skipping pip install"; \
fi
# Variables de entorno
ENV PYTHONPATH=/home/jovyan/work
# Permisos para el usuario jovyan (el que usa Jupyter)
RUN chown -R jovyan:jovyan /home/jovyan
USER jovyan
# Puerto por defecto de Jupyter
EXPOSE 8888
# ===== Comando de arranque =====
CMD bash -c '\
cd /home/jovyan/work && \
export PYTHONPATH=/home/jovyan/work:$PYTHONPATH && \
# Deshabilitar JupyterLab (usar Notebook clásico)
jupyter server extension disable jupyterlab >/dev/null 2>&1 || true && \
# Timeout de inactividad (0 = nunca apaga)
IDLE="${JUPYTER_IDLE_TIMEOUT:-0}" && \
exec jupyter notebook \
--no-browser \
--ip=0.0.0.0 \
--port=8888 \
--NotebookApp.token="" \
--NotebookApp.password="" \
--NotebookApp.shutdown_no_activity_timeout="${IDLE}" \
--ServerApp.shutdown_no_activity_timeout="${IDLE}" \
'