asmithaaa commited on
Commit
0e2d107
·
verified ·
1 Parent(s): 6058d8b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -10
Dockerfile CHANGED
@@ -1,20 +1,34 @@
1
- FROM python:3.13.5-slim
 
2
 
 
3
  WORKDIR /app
4
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
 
 
 
13
 
14
- RUN pip3 install -r requirements.txt
 
15
 
16
- EXPOSE 8501
 
 
 
 
17
 
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
19
 
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
+ # 1. Use a standard Python image
2
+ FROM python:3.10-slim
3
 
4
+ # 2. Set the working directory
5
  WORKDIR /app
6
 
7
+ # 3. Install critical system dependencies for OpenCV and YOLO
8
+ # We use libgl1 instead of libgl1-mesa-glx for better compatibility
9
  RUN apt-get update && apt-get install -y \
10
+ libgl1 \
11
+ libglib2.0-0 \
12
+ gcc \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # 4. Copy and install Python dependencies
16
+ # Now that your file is named 'requirements.txt', this will work
17
+ COPY requirements.txt .
18
+ RUN pip install --no-cache-dir --upgrade pip && \
19
+ pip install --no-cache-dir -r requirements.txt
20
 
21
+ # 5. Copy your project files
22
+ COPY . .
23
 
24
+ # 6. Set permissions for Hugging Face (User 1000)
25
+ RUN useradd -m -u 1000 user
26
+ USER user
27
+ ENV HOME=/home/user \
28
+ PATH=/home/user/.local/bin:$PATH
29
 
30
+ # 7. Expose the Hugging Face default port
31
+ EXPOSE 7860
32
 
33
+ # 8. Start the app
34
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableCORS=false"]