File size: 685 Bytes
eb7c28e
 
 
 
 
 
 
 
 
 
f0eeb06
 
 
 
eb7c28e
 
f0eeb06
 
 
 
eb7c28e
 
 
 
f0eeb06
 
eb7c28e
f0eeb06
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
# Use Python 3.11 (has SQLite 3.40+) instead of 3.10
FROM python:3.11-slim

# Create non-root user for security
RUN useradd -m -u 1000 user
USER user

# Set environment variables
ENV PATH="/home/user/.local/bin:$PATH"
ENV PYTHONUNBUFFERED=1

# Set working directory
WORKDIR /app

# Copy requirements first for better caching
COPY --chown=user ./requirements.txt requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy application files
COPY --chown=user . /app

# Expose port 7860 (Hugging Face Spaces requirement)
EXPOSE 7860

# Run the FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]