File size: 975 Bytes
5768d5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5d8bd1
5768d5b
 
 
 
 
 
 
 
 
c5d8bd1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use a stable slim Python base
FROM python:3.11-slim

# Prevent Python from writing .pyc files and enable unbuffered stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Ensure /tmp is present and writable (Hugging Face uses /tmp)
ENV TMPDIR=/tmp
RUN mkdir -p /tmp && chmod 1777 /tmp

# Create app directory
WORKDIR /app

# Copy project files
COPY . /app

# Install system dependencies required for pandas/openpyxl build
RUN apt-get update \
  && apt-get install -y --no-install-recommends build-essential libpq-dev gcc g++ \
  && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
# If your pipeline requires google-genai, include it; otherwise adjust as needed.
RUN pip install --no-cache-dir -r requirements.txt

# Create a non-root user (optional but recommended)
RUN useradd -m appuser || true
USER appuser

# Expose port
EXPOSE 7860

# Command to run the app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]