FROM python:3.10 # Install system dependencies RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 # Install Poetry RUN curl -sSL https://install.python-poetry.org | python3 - # Set Poetry path (ensures it's available in future RUN commands) ENV PATH="/root/.local/bin:$PATH" # Create a symlink so Poetry is accessible system-wide RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry # Set working directory WORKDIR /code # Copy Poetry files first to optimize Docker caching COPY pyproject.toml poetry.lock /code/ # Install dependencies using Poetry RUN poetry install --no-root --no-interaction --no-ansi # Copy the rest of the project files COPY . /code # Ensure start script is executable RUN chmod +x /code/start.sh # Create necessary directories and set permissions before switching to non-root user RUN mkdir -p /code/uploaded_videos /code/output_frames \ && chown -R 1000:1000 /code # # Switch to non-root user # USER 1000 # Expose the application port EXPOSE 8000 # Ensure logs are not buffered ENV PYTHONUNBUFFERED=1 # Run the application using Poetry's virtual environment CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]