-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile.label-studio
More file actions
70 lines (54 loc) · 2.94 KB
/
Copy pathDockerfile.label-studio
File metadata and controls
70 lines (54 loc) · 2.94 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
# =============================================================================
# EduMIND × Label Studio — ML Backend Dockerfile
# =============================================================================
# Base image: python:3.10-slim (matches pyproject.toml requires-python ~=3.10)
# Build context: project root (docker build -f Dockerfile.label-studio .)
# Uses 'uv' for fast, reproducible dependency installation from uv.lock.
# =============================================================================
FROM python:3.10-slim AS base
# --- System dependencies ------------------------------------------------------
# ffmpeg: required by openai-whisper for audio decoding
# libgomp1: required by sentence-transformers (OpenMP for CPU parallelism)
# git: required by HuggingFace / other VCS dependencies if any
# curl: required for health-checking
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgomp1 \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# --- Python environment -------------------------------------------------------
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /workspace
# --- Install uv --------------------------------------------------------------
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# --- Copy project configurations first for dependency caching ----------------
COPY pyproject.toml uv.lock README.md LICENSE ./
# --- Create dummy package directory for flit & uv dependency installation ---
RUN mkdir edumind && touch edumind/__init__.py
# --- Install system-wide python dependencies via uv --------------------------
# --system: Installs packages directly into the system python environment
# ".[label-studio]": Installs the package along with the label-studio optional dependency group
RUN uv pip install --system ".[label-studio]"
# --- Copy remaining source files ---------------------------------------------
COPY edumind/ ./edumind/
COPY label_studio_backend/ ./label_studio_backend/
# --- Install EduMIND in editable mode (without rebuilding dependencies) ------
RUN uv pip install --system -e . --no-deps
# --- Data directories (populated via volume mounts in docker-compose) ---------
RUN mkdir -p data/raw/audio_chunks \
data/raw/pdf_slides \
data/processed
# --- Non-root user for security -----------------------------------------------
RUN useradd -m -u 1000 edumind && chown -R edumind:edumind /workspace
USER edumind
# --- Expose ML Backend port ---------------------------------------------------
EXPOSE 9090
# --- Health-check: confirm the backend is responding -------------------------
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:9090/health || exit 1
# --- Entrypoint ---------------------------------------------------------------
CMD ["label-studio-ml", "start", "/workspace/label_studio_backend", \
"--host", "0.0.0.0", \
"--port", "9090"]