FROM python:3.8 # Create a non-root user RUN useradd -m -u 1000 user USER user WORKDIR /home/user ENV PATH="/home/user/.local/bin:$PATH" # Install system packages needed for OpenCV USER root RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ libgl1-mesa-glx libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* USER user # Copy your code COPY --chown=user . . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip setuptools wheel RUN pip install --no-cache-dir -e . # Create model-store directory (ensure the path is correct and accessible) RUN mkdir -p /home/user/torchserve/model-store RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/ RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/ EXPOSE 7860 CMD ["python", "app.py"]