Spaces:
Running
Running
Tirush Dumil
commited on
Commit
·
f764600
1
Parent(s):
ddba2a0
Fix LFS for safetensors model
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python lightweight image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# 1. Install system dependencies (CRITICAL for OpenCV/cv2)
|
| 5 |
+
# Without 'libgl1', your app will crash when running tools.py
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
libgl1-mesa-glx \
|
| 8 |
+
libglib2.0-0 \
|
| 9 |
+
git \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# 2. Set up a user (Hugging Face security requirement)
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
USER user
|
| 15 |
+
ENV HOME=/home/user \
|
| 16 |
+
PATH=/home/user/.local/bin:$PATH
|
| 17 |
+
|
| 18 |
+
# 3. Set working directory
|
| 19 |
+
WORKDIR $HOME/app
|
| 20 |
+
|
| 21 |
+
# 4. Copy requirements and install Python libraries
|
| 22 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 23 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 24 |
+
|
| 25 |
+
# 5. Copy your application code
|
| 26 |
+
COPY --chown=user . .
|
| 27 |
+
|
| 28 |
+
# 6. Expose the required port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# 7. Run Streamlit
|
| 32 |
+
# --server.enableXsrfProtection=false is REQUIRED for file uploads to work in Docker Spaces
|
| 33 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|