# Use an official Python runtime as a parent image # Slim version is smaller but full version prevents some build issues with large ML libs FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set work directory WORKDIR /app # Install system dependencies (needed for some python packages) RUN apt-get update && apt-get install -y \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies # Install Python dependencies using uv for reproducible builds RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:/app/.venv/bin:${PATH}" # Copy all metadata and manifests COPY pyproject.toml uv.lock openenv.yaml README.md ./ # Copy the source code (required for uv project sync) COPY backend/ /app/backend/ COPY server/ /app/server/ COPY frontend/ /app/frontend/ # Root-level entry points required by the OpenEnv grader COPY inference.py /app/inference.py # Sync dependencies (this now includes the project itself) RUN uv sync --no-dev # Expose the port (7860 is the official default for HuggingFace Spaces) EXPOSE 7860 # Run the application via the uv-managed server script # This ensures all compliance checks (uv.lock, [project.scripts]) are utilized CMD ["uv", "run", "server"]