File size: 734 Bytes
661c514
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.10 slim image as base
FROM python:3.10-slim

# Create non-root user
RUN useradd -m -u 1000 user


# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PORT=7860

# Create and set working directory
WORKDIR $HOME/app

# Copy requirements first to leverage Docker cache
COPY --chown=user requirements.txt .

# Switch to non-root user

USER user


# Install dependencies
RUN pip install --user -r requirements.txt

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

# Create uploads directory
RUN mkdir -p uploads

# Expose port
EXPOSE ${PORT}

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