vikramvasudevan commited on
Commit
95474d1
·
verified ·
1 Parent(s): 9538b58
Files changed (1) hide show
  1. Dockerfile +16 -20
Dockerfile CHANGED
@@ -1,31 +1,27 @@
1
- # Base image: Python 3.11 slim for better compatibility with OpenAI & Pydantic
2
- FROM python:3.11-slim
3
 
4
- # Install system dependencies needed for building packages
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
- build-essential \
7
- libffi-dev \
8
- libssl-dev \
9
- curl \
10
- git \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Create a non-root user
14
  RUN useradd -m -u 1000 user
15
  USER user
16
  ENV PATH="/home/user/.local/bin:$PATH"
17
 
18
- # Set working directory
19
  WORKDIR /app
20
 
21
- # Copy and install dependencies
22
- COPY --chown=user ./requirements.txt requirements.txt
23
- RUN python -m pip install --upgrade pip \
24
- && pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
25
 
26
- # Copy app code
27
  COPY --chown=user . /app
28
 
29
- # Expose port and run Uvicorn
30
- EXPOSE 7860
31
  CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.13.6
 
2
 
3
+ # Avoid running as root
 
 
 
 
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
 
8
  WORKDIR /app
9
 
10
+ # Install system dependencies needed to build packages like pydantic-core
11
+ RUN apt-get update && apt-get install -y \
12
+ build-essential \
13
+ curl \
14
+ git \
15
+ libssl-dev \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Copy requirements and install
19
+ COPY --chown=user requirements.txt .
20
+ RUN pip install --upgrade pip
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy app
24
  COPY --chown=user . /app
25
 
26
+ # HF Spaces expects port 7860 or 8080; using 7860
 
27
  CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]