nakas commited on
Commit
651dee2
·
verified ·
1 Parent(s): c9a5d92

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -9
Dockerfile CHANGED
@@ -1,19 +1,19 @@
1
  FROM jupyter/minimal-notebook:python-3.9
2
 
3
- # Install additional packages
4
- RUN pip install gradio
5
 
6
- # Create a very simple Python script to relay Jupyter through Gradio on port 7860
7
- RUN echo "import gradio as gr; import os; os.system('jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token=\\\"\\\" --NotebookApp.password=\\\"\\\" &'); demo = gr.Interface(fn=lambda: None, inputs=[], outputs=gr.HTML('<iframe src=\"/proxy/8888/tree\" width=\"100%\" height=\"800px\"></iframe>'), title=\"Jupyter Notebook\"); demo.launch(server_port=7860)" > /home/jovyan/relay.py
8
 
9
- # Copy notebook
 
10
  COPY welcome.ipynb /home/jovyan/
11
 
12
- # Use the non-root jovyan user (comes with the Jupyter image)
13
  USER jovyan
14
 
15
- # Expose port 7860 (required by Hugging Face Spaces)
16
  EXPOSE 7860
17
 
18
- # Run the relay script
19
- CMD ["python", "/home/jovyan/relay.py"]
 
1
  FROM jupyter/minimal-notebook:python-3.9
2
 
3
+ USER root
 
4
 
5
+ # Install Gradio
6
+ RUN pip install --no-cache-dir gradio
7
 
8
+ # Copy application files
9
+ COPY app.py /home/jovyan/
10
  COPY welcome.ipynb /home/jovyan/
11
 
12
+ # Switch back to non-root user
13
  USER jovyan
14
 
15
+ # Expose the port Hugging Face expects
16
  EXPOSE 7860
17
 
18
+ # Run the app
19
+ CMD ["python", "/home/jovyan/app.py"]