train_utility/Dockerfile

41 lines
1.2 KiB
Docker

FROM python:3.11-slim
# Install system dependencies needed for OpenCV, PyTorch, and Ultralytics
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgl1 \
libglib2.0-0 \
libgomp1 \
git \
&& rm -rf /var/lib/apt/lists/*
# Pin the installer as well as application dependencies.
RUN pip install --no-cache-dir uv==0.10.6
# Set working directory
WORKDIR /workspace
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/opt/venv \
ULTRALYTICS_SAFE_LOAD=1
# Install the exact dependency set recorded in uv.lock. Keeping the project out of
# this layer allows dependency caching while source files change.
COPY pyproject.toml uv.lock README.md ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev --no-install-project
# Copy source code and install the project without re-resolving dependencies.
COPY src ./src
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
ENV PATH="/opt/venv/bin:$PATH"
# Expose Web UI port and MLflow port
EXPOSE 8000
EXPOSE 5000
# Start Web UI using the system entry point
CMD ["yolo-train-webui", "--host", "0.0.0.0", "--port", "8000"]