ai / Dockerfile
maddyrox's picture
Upload 23 files
245a4de verified
raw
history blame contribute delete
877 Bytes
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /code
# Install system dependencies (required for OpenCV)
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt /code/requirements.txt
# Install PyTorch CPU-only (Detailed command significantly reduces size/memory usage)
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install other python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application
COPY . /code
# Expose the port
EXPOSE 7860
# Command to run the application
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]