premo625 commited on
Commit
73888be
·
verified ·
1 Parent(s): be62a13

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -10
Dockerfile CHANGED
@@ -2,10 +2,19 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
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
  # Set environment variables for UTF-8 and production
11
  ENV PYTHONUNBUFFERED=1 \
@@ -13,17 +22,17 @@ ENV PYTHONUNBUFFERED=1 \
13
  LC_ALL=C.UTF-8 \
14
  LANG=C.UTF-8
15
 
16
- # Install dependencies
17
- COPY requirements.txt .
18
- RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- COPY app.main .
21
  COPY . .
22
 
23
  # Expose the port for Hugging Face Spaces
24
  EXPOSE 7860
25
 
26
-
 
 
27
 
28
  # Use python -m uvicorn for reliability
29
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies for numpy, pandas, PIL, etc.
6
+ RUN apt-get update && \
7
+ apt-get install -y --no-install-recommends \
8
+ build-essential \
9
+ libglib2.0-0 \
10
+ libsm6 \
11
+ libxext6 \
12
+ libxrender-dev \
13
+ gcc \
14
+ git \
15
+ wget \
16
+ curl \
17
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
18
 
19
  # Set environment variables for UTF-8 and production
20
  ENV PYTHONUNBUFFERED=1 \
 
22
  LC_ALL=C.UTF-8 \
23
  LANG=C.UTF-8
24
 
25
+ COPY requirements.txt ./
26
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
 
27
 
 
28
  COPY . .
29
 
30
  # Expose the port for Hugging Face Spaces
31
  EXPOSE 7860
32
 
33
+ # Healthcheck (optional, but recommended for cloud)
34
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
35
+ CMD curl --fail http://localhost:7860/docs || exit 1
36
 
37
  # Use python -m uvicorn for reliability
38
+ CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"]