Threat-Detection / Dockerfile
Subh775's picture
Update Dockerfile
9ac256a verified
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"]