# Embeddings API Server # Multi-stage build for smaller final image FROM python:3.11.12-slim AS builder # Install uv COPY --from=ghcr.io/astral-sh/uv:0.10 /uv /usr/local/bin/uv WORKDIR /app # Copy project files COPY pyproject.toml README.md ./ COPY src/ ./src/ # Install dependencies (with optional extras for backends) RUN uv sync --frozen --no-dev --all-extras || uv sync --no-dev --all-extras # Production image FROM python:3.11.12-slim WORKDIR /app # Copy virtual environment from builder COPY --from=builder /app/.venv /app/.venv # Copy source code COPY src/ ./src/ # Set environment variables ENV PATH="/app/.venv/bin:$PATH" ENV PYTHONUNBUFFERED=1 ENV EMB_HOST=0.0.0.0 ENV EMB_PORT=14100 # Health check (using Python since curl not available in slim image) HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:14100/health')" || exit 1 # Expose port EXPOSE 14100 # Run the server CMD ["python", "-m", "embeddings.cli"]