Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official Python base image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Add a non-root user required by HF Spaces
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
|
| 7 |
+
# Set working directory
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Copy requirements file and install dependencies
|
| 11 |
+
COPY requirements.txt ./requirements.txt
|
| 12 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# Copy your Jupyter notebooks or other files
|
| 15 |
+
COPY . /app
|
| 16 |
+
|
| 17 |
+
# Switch to the non-root user
|
| 18 |
+
USER user
|
| 19 |
+
|
| 20 |
+
# Set PATH and HOME environment variables correctly for the user
|
| 21 |
+
ENV HOME=/home/user \
|
| 22 |
+
PATH=/home/user/.local/bin:$PATH
|
| 23 |
+
|
| 24 |
+
# Run JupyterLab server, accessible from outside with no token by default (token can be set with JUPYTER_TOKEN env var)
|
| 25 |
+
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=7860", "--no-browser", "--allow-root"]
|