Upload folder using huggingface_hub
Browse files- Dockerfile +14 -6
Dockerfile
CHANGED
|
@@ -1,21 +1,29 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
# Copy requirements and install
|
| 11 |
COPY --chown=user:user requirements.txt .
|
| 12 |
-
RUN pip install --
|
| 13 |
|
| 14 |
# Copy application files
|
| 15 |
COPY --chown=user:user . .
|
| 16 |
|
| 17 |
-
# Expose port 7860
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
# Run Streamlit
|
| 21 |
-
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies (needed for OpenCV/Pillow if your detector uses them)
|
| 4 |
+
USER root
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
libgl1-mesa-glx \
|
| 7 |
+
libglib2.0-0 \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# Setup non-root user
|
| 11 |
RUN useradd -m -u 1000 user
|
| 12 |
USER user
|
| 13 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 14 |
|
| 15 |
+
# Set working directory to user home
|
| 16 |
+
WORKDIR /home/user/app
|
| 17 |
|
| 18 |
# Copy requirements and install
|
| 19 |
COPY --chown=user:user requirements.txt .
|
| 20 |
+
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 21 |
|
| 22 |
# Copy application files
|
| 23 |
COPY --chown=user:user . .
|
| 24 |
|
| 25 |
+
# Expose port 7860
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Run Streamlit with flags to bypass common HF proxy issues
|
| 29 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
|