nakas commited on
Commit
1aa3e81
·
verified ·
1 Parent(s): d388b58

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -2
Dockerfile CHANGED
@@ -29,5 +29,12 @@ COPY --chown=jupyter:jupyter welcome.ipynb /app/notebooks/
29
  # Expose port
30
  EXPOSE 7860
31
 
32
- # Start Jupyter notebook with mobile-friendly options
33
- CMD ["python", "-c", "import gradio as gr; import subprocess; import os; proc = subprocess.Popen(['jupyter', 'notebook', '--ip=0.0.0.0', '--port=8888', '--no-browser', '--NotebookApp.token=', '--NotebookApp.password=', '--NotebookApp.allow_origin=*', '--NotebookApp.disable_check_xsrf=True']); demo = gr.Interface(fn=lambda: None, inputs=[], outputs=[gr.HTML('<div style=\"text-align:center; padding:10px;\"><h2>Mobile-Friendly Jupyter Notebook</h2><p>The notebook interface will appear below:</p></div><iframe src=\"/proxy/8888/tree\" width=\"100%\" height=\"800px\" frameborder=\"0\" style=\"overflow:hidden;\"></iframe>')], title='Jupyter Notebook', css=\".gradio-container {max-width: 100% !important; padding: 0 !important;} .min-h-\[48rem\] {min-height: auto !important;}\"); demo.launch(server_port=7860, share=False)"]
 
 
 
 
 
 
 
 
29
  # Expose port
30
  EXPOSE 7860
31
 
32
+ # Create a script to run both servers
33
+ RUN echo '#!/bin/bash\n\
34
+ jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token="" --NotebookApp.password="" --NotebookApp.allow_origin="*" --NotebookApp.disable_check_xsrf=True --notebook-dir=/app/notebooks &\n\
35
+ python -c "import gradio as gr; demo = gr.Interface(fn=lambda: None, inputs=[], outputs=[gr.HTML(\"<div style=\\\"text-align:center; padding:10px;\\\"><h2>Mobile-Friendly Jupyter Notebook</h2><p>The notebook interface will appear below:</p></div><iframe src=\\\"/proxy/8888/tree\\\" width=\\\"100%\\\" height=\\\"800px\\\" frameborder=\\\"0\\\" style=\\\"overflow:hidden;\\\"></iframe>\")], title=\"Jupyter Notebook\", css=\".gradio-container {max-width: 100% !important; padding: 0 !important;} .min-h-\[48rem\] {min-height: auto !important;}\"); demo.launch(server_port=7860, share=False)"\n' > /app/start.sh
36
+
37
+ RUN chmod +x /app/start.sh
38
+
39
+ # Start servers
40
+ CMD ["/app/start.sh"]