MHRN-Space / Dockerfile
ThomasHeisig's picture
Sync GitHub main af692537c27175c8410bf57a747be0caf23718e2
e445d6f verified
Raw History Blame Contribute Delete
2.09 kB
# ============================================================================
# MHRN — Dockerfile
# ============================================================================
# Multi-stage build for minimal production image.
#
# Build: docker build -t mhrn .
# Run: docker run --rm -p 8767:8767 mhrn
# Run with: docker run --rm -v ./configs:/app/configs mhrn \
# python -m src.main --config configs/poc_config.yaml
# ============================================================================
# ---- Build stage -----------------------------------------------------------
FROM python:3.13-slim AS builder
WORKDIR /build
# Install build dependencies
RUN pip install --no-cache-dir build "setuptools>=68" wheel
# Copy package metadata and sources
COPY pyproject.toml setup.py README.md LICENSE ./
COPY src/ src/
# Build wheel
RUN python -m build --wheel --no-isolation
# ---- Runtime stage ---------------------------------------------------------
FROM python:3.13-slim
WORKDIR /app
# Install runtime dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy built wheel from builder
COPY --from=builder /build/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm /tmp/*.whl
# Copy source code (for editable imports)
COPY src/ src/
COPY configs/ configs/
COPY scripts/ scripts/
COPY research/ research/
COPY docs/ docs/
COPY project_identity.json NAMING.md README.md ./
# Public instrument bytes only; the response collector and private data stay separate.
COPY review_portal/catalogue.py review_portal/catalogue.py
RUN python -c "from pathlib import Path; from src.dashboard.external_review import build_external_review_status; status = build_external_review_status(Path('/app')); assert status['available'], status"
# Expose dashboard port
EXPOSE 8765
# Hugging Face Spaces starts the integrated dashboard from this command.
CMD ["python", "-m", "src.main", "--config", "configs/poc_config.yaml", "--dashboard-host", "0.0.0.0", "--dashboard-port", "8767"]