Install modular API, voice and embedding extras and use the supported single-process server entrypoint. Drain worker SIGTERM shutdown within the Compose grace period. Add isolated HTTPS embedding fixtures, bounded intake execution and reproducible account, publication, restart, lease-recovery and shutdown acceptance. Eight operational scenarios passed with zero real-provider calls.
38 lines
1013 B
Docker
38 lines
1013 B
Docker
FROM python:3.11-slim
|
|
|
|
# Set environment variables for Python
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy dependency configuration
|
|
COPY pyproject.toml /app/
|
|
|
|
# Stub package to leverage Docker layer caching for pip dependencies
|
|
RUN mkdir -p /app/app && touch /app/app/__init__.py \
|
|
&& pip install --no-cache-dir -e ".[api,voice,embedding]"
|
|
|
|
# Copy application source code and migrations
|
|
COPY app/ /app/app/
|
|
COPY migrations/ /app/migrations/
|
|
COPY alembic.ini /app/
|
|
COPY data/ /app/data/
|
|
|
|
# Reinstall editable package to ensure all entry points and modules are bound
|
|
RUN pip install --no-deps -e .
|
|
|
|
# Expose default API port
|
|
EXPOSE 8000
|
|
|
|
# Default command: FastAPI API server
|
|
CMD ["python", "-m", "app.server", "--host", "0.0.0.0", "--port", "8000"]
|