File size: 846 Bytes
37b09ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Start with Python base image
FROM python:3.9-slim

# Install system dependencies as root
USER root

# Install required system packages
RUN apt-get update && apt-get install -y \
    libtorrent-rasterbar-dev \
    build-essential \
    libssl-dev \
    libboost-system-dev \
    libmagic1 \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app

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

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

# Add this after COPY . .
RUN mkdir -p /app/static && chown user:user /app/static

# Expose Hugging Face default port
EXPOSE 7860

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