Glainez commited on
Commit
c94c065
·
verified ·
1 Parent(s): d0326ef

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -6
Dockerfile CHANGED
@@ -1,21 +1,29 @@
1
  FROM python:3.11-slim
2
 
3
- # Create a non-root user (HuggingFace Docker Spaces requirement)
 
 
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
- WORKDIR /app
 
9
 
10
  # Copy requirements and install
11
  COPY --chown=user:user requirements.txt .
12
- RUN pip install --user --no-cache-dir -r requirements.txt
13
 
14
  # Copy application files
15
  COPY --chown=user:user . .
16
 
17
- # Expose port 7860 for HuggingFace Spaces
18
  EXPOSE 7860
19
 
20
- # Run Streamlit on the specified port
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"]