nakas commited on
Commit
ae648f1
·
verified ·
1 Parent(s): 17c7fc7

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ RUN pip install --no-cache-dir \
7
+ jupyter \
8
+ notebook \
9
+ ipywidgets \
10
+ numpy \
11
+ pandas \
12
+ matplotlib \
13
+ seaborn \
14
+ scikit-learn \
15
+ transformers \
16
+ torch \
17
+ gradio
18
+
19
+ # Create a non-root user to run Jupyter
20
+ RUN useradd -m jupyter
21
+ RUN mkdir -p /app/notebooks && chown -R jupyter:jupyter /app
22
+
23
+ # Switch to non-root user
24
+ USER jupyter
25
+
26
+ # Copy example notebook
27
+ COPY --chown=jupyter:jupyter welcome.ipynb /app/notebooks/
28
+
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)"]