File size: 784 Bytes
048e6d6
2bf6a09
 
22fc29e
 
 
 
 
2bf6a09
 
6e6ec6e
715c3ae
2bf6a09
6e6ec6e
 
715c3ae
22fc29e
e395b1b
715c3ae
2bf6a09
 
 
 
 
 
 
 
 
 
ddc6874
2bf6a09
0b2dbc8
2aea684
0b2dbc8
e395b1b
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
FROM python:3.10-slim

# Install required system packages
RUN apt update && apt install -y \
    git \
    libgl1 \
    libglib2.0-0 \
    && apt clean

# Set working directory
WORKDIR /app

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

# Copy the entire project directory
COPY . .

# Create tmp and output directories with full permissions
RUN mkdir -p /app/tmp /app/output && \
    chmod 777 /app/tmp /app/output

# Create a non-root user and set ownership
RUN useradd -m -u 1000 appuser && \
    chown -R appuser:appuser /app

# Switch to non-root user
USER appuser

# Expose the port for FastAPI (Hugging Face Spaces)
EXPOSE 7860

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