# ContextFS Sync Service Dockerfile
# Builds a lightweight FastAPI service for sync operations
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY pyproject.toml ./
# Install Python dependencies
RUN pip install --no-cache-dir \
fastapi>=0.109.0 \
uvicorn[standard]>=0.27.0 \
sqlalchemy[asyncio]>=2.0.0 \
asyncpg>=0.29.0 \
pydantic>=2.0.0 \
pydantic-settings>=2.0.0 \
pgvector>=0.2.0 \
httpx>=0.27.0
# Copy source code
COPY src/contextfs /app/src/contextfs
COPY service /app/service
# Set Python path
ENV PYTHONPATH=/app/src:/app
# Expose port
EXPOSE 8766
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8766/health').raise_for_status()"
# Run the service
CMD ["uvicorn", "service.api.main:app", "--host", "0.0.0.0", "--port", "8766"]