File size: 1,052 Bytes
b2be963
 
 
60470bc
 
 
 
 
 
 
b2be963
 
 
 
 
 
 
 
 
60470bc
b2be963
 
60470bc
b2be963
 
60470bc
b2be963
 
 
 
 
 
 
 
 
 
 
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
36
37
38
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set environment variables for performance
ENV PYTHONUNBUFFERED=1 \
    PYTHONOPTIMIZE=1 \
    HOST=0.0.0.0 \
    PORT=7860 \
    DATABASE_URL=sqlite:///./vortex.db

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \

    build-essential \
    fonts-dejavu-core \
    && rm -rf /var/lib/apt/lists/*

# Copy only requirements first to leverage Docker layer caching
COPY requirements.txt .

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

# Copy the rest of the application code
COPY . .

# Hugging Face Spaces runs as user with UID 1000
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

# Expose port 7860 as required by Hugging Face Spaces
EXPOSE 7860

# Command to run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips='*'"]