# Use Python 3.12 base image and install uv FROM python:3.12-slim # Install uv RUN pip install uv # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy \ PYTHONPATH=/app \ UV_CACHE_DIR=/tmp/.cache # Set working directory WORKDIR /app # Copy pyproject.toml and uv.lock first for better layer caching COPY pyproject.toml uv.lock ./ # Install dependencies using uv RUN uv sync --frozen --no-cache # Copy the application code COPY backend/ ./backend/ COPY data/ ./data/ # Create writable directories for Milvus lock files RUN mkdir -p backend/api/static /tmp/vector_db && \ chmod 777 /tmp/vector_db # Copy vector database files to writable location COPY data/processed/vector_db/* /tmp/vector_db/ # Expose the port EXPOSE 8000 # Command to run the application CMD ["uv", "run", "uvicorn", "backend.api.main:app", "--host", "0.0.0.0", "--port", "8000"]