-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
73 lines (57 loc) · 3.13 KB
/
Dockerfile.dev
File metadata and controls
73 lines (57 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# VideoAnnotator Development Docker Image - Simple Approach
# This image includes GPU support AND your local model cache for instant testing
# Copies your existing models/ and weights/ directories
#
# Usage:
# docker build -f dockerfile.dev -t videoannotator:dev .
# docker run --gpus all --rm -p 8000:8000 -v ${PWD}/data:/app/data videoannotator:dev
FROM nvidia/cuda:12.6.0-runtime-ubuntu24.04
# Use bash with pipefail so RUN commands that use a pipe fail when any stage does
SHELL ["/bin/bash","-o","pipefail","-lc"]
# Prevent interactive prompts during package installation
ARG DEBIAN_FRONTEND=noninteractive
# Install base packages and locales in a single RUN to reduce layers and avoid
# pulling recommended packages unnecessarily (DL3015, DL3059)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl python3 python3-venv python3-dev git git-lfs ffmpeg \
libgl1-mesa-dri libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
# Export UTF-8 locale for all processes
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV UV_LINK_MODE=copy
# Initialize Git LFS, install uv and set PATH, copy project files, and install
# dependencies in grouped RUNs to reduce layers. The uv installer is a piped
# command; using SHELL with pipefail above ensures failures are detected (DL4006).
RUN git lfs install \
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& export PATH="/root/.local/bin:${PATH}" \
&& mkdir -p /app
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /app
# Copy project files explicitly so production images can exclude models/weights,
# while the dev image intentionally includes them.
COPY pyproject.toml uv.lock ./
COPY api_server.py ./
COPY src/ ./src/
COPY configs/ ./configs/
COPY scripts/ ./scripts/
# Copy your local models and weights for fast offline-ish iteration
COPY models/ /app/models/
COPY weights/ /app/weights/
# Install dependencies (torch/torchvision/torchaudio come from the configured
# `pytorch-cu124` uv index in pyproject.toml).
RUN uv sync --frozen --no-editable \
&& HADOLINT_DEST_DIR=/usr/local/bin bash scripts/install_hadolint.sh \
&& uv tool install specify-cli --from git+https://github.com/github/spec-kit.git
# Verify GPU access and model cache (no model downloading needed!)
RUN uv run python3 -c "import torch; from pathlib import Path; print(f'[DEV BUILD] CUDA available: {torch.cuda.is_available()}'); models_count = len(list(Path('/app/models').rglob('*'))) if Path('/app/models').exists() else 0; weights_count = len(list(Path('/app/weights').rglob('*'))) if Path('/app/weights').exists() else 0; print(f'[DEV BUILD] Models directory: {models_count} files'); print(f'[DEV BUILD] Weights directory: {weights_count} files'); print('[DEV BUILD] Development image ready with local model cache!');"
# Set environment for development
ENV PYTHONUNBUFFERED=1
ENV CUDA_VISIBLE_DEVICES=0
# Create directories for mounted volumes
RUN mkdir -p /app/data /app/output /app/logs
EXPOSE 18011
CMD ["uv", "run", "python3", "api_server.py", "--log-level", "info", "--port", "18011"]