vish85521 commited on
Commit
420f7bc
·
verified ·
1 Parent(s): dffa8c2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -34
Dockerfile CHANGED
@@ -1,46 +1,42 @@
1
- # Hugging Face Spaces (Docker) - FastAPI backend
2
- # Build context: this folder
3
-
4
  FROM python:3.11-slim
5
 
6
  ENV PYTHONDONTWRITEBYTECODE=1 \
7
- PYTHONUNBUFFERED=1
 
 
 
8
 
9
  WORKDIR /code
10
 
11
- # System deps: build tools + Postgres client libs (psycopg2) + minimal OpenCV runtime deps
12
- RUN apt-get update \
13
- && apt-get install -y --no-install-recommends \
14
- build-essential \
15
- gcc \
16
- libpq-dev \
17
- libgl1 \
18
- libglib2.0-0 \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
- # Install Python dependencies.
22
- # Note: This repo folder doesn't include requirements.txt/pyproject.toml, so we install pinned-at-runtime deps directly.
23
- RUN pip install --no-cache-dir --upgrade pip \
24
- && pip install --no-cache-dir \
25
- fastapi \
26
- "uvicorn[standard]" \
27
- sqlalchemy \
28
- psycopg2-binary \
29
- pydantic \
30
- pydantic-settings \
31
- bcrypt \
32
- "python-jose[cryptography]" \
33
- redis \
34
- celery \
35
- aiofiles \
36
- python-multipart \
37
- google-genai \
38
- opencv-python-headless
39
-
40
- # Copy your FastAPI package into /code/app so imports like `app.main:app` work.
41
  COPY . /code/app
42
 
43
- # Hugging Face Spaces sets PORT; default to 7860 (HF convention) if not present.
44
  EXPOSE 7860
45
 
46
- CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"]
 
 
 
 
1
  FROM python:3.11-slim
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_NO_CACHE_DIR=1 \
6
+ PYTHONPATH=/code \
7
+ PORT=7860
8
 
9
  WORKDIR /code
10
 
11
+ # Minimal system deps for common Python packages in this app.
12
+ RUN apt-get update && apt-get install -y --no-install-recommends \
13
+ build-essential \
14
+ libglib2.0-0 \
15
+ libsm6 \
16
+ libxext6 \
17
+ libxrender1 \
 
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Install Python dependencies directly (no requirements file in this folder).
21
+ RUN pip install --no-cache-dir \
22
+ fastapi \
23
+ "uvicorn[standard]" \
24
+ sqlalchemy \
25
+ psycopg2-binary \
26
+ redis \
27
+ celery \
28
+ pydantic-settings \
29
+ python-jose \
30
+ bcrypt \
31
+ aiofiles \
32
+ python-multipart \
33
+ email-validator \
34
+ google-genai \
35
+ opencv-python-headless
36
+
37
+ # Copy app package so imports like "from app..." keep working.
 
 
38
  COPY . /code/app
39
 
 
40
  EXPOSE 7860
41
 
42
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]