File size: 915 Bytes
e50565d
 
 
 
9ac256a
e50565d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
FROM python:3.9-slim

# Install system dependencies for OpenCV and GLib
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements first to leverage Docker cache
COPY requirements.txt .

# Install dependencies
# Note: If 'rfdetr' is not on PyPI, ensure the wheel or source is available 
# or that the folder is copied in the next step before running the app.
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . .

# Permissions for the start script
RUN chmod +x start.sh

# Environment variables for CPU optimization & Gunicorn
ENV OMP_NUM_THREADS=4
ENV MKL_NUM_THREADS=4
ENV MPLCONFIGDIR=/tmp/.matplotlib
ENV PORT=7860

# Expose port
EXPOSE 7860

# Start command
CMD ["./start.sh"]