Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| # Install system dependencies (as root) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| graphviz \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| # Switch to non-root user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set work directory | |
| WORKDIR /home/user/app | |
| # Install Python dependencies (as user, into ~/.local) | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --user --no-cache-dir -r requirements.txt | |
| # Copy the application code and set ownership | |
| COPY --chown=user . . | |
| # Generate Prisma Client (as user, ensures Python client is generated) | |
| RUN python3 -m prisma generate --schema=wellsync_ai/data/schema.prisma | |
| # Expose the port (Hugging Face Spaces expects 7860) | |
| EXPOSE 7860 | |
| # Run FastAPI | |
| # Run FastAPI (Pointing to the correct module verify path) | |
| CMD ["uvicorn", "wellsync_ai.main:app", "--host", "0.0.0.0", "--port", "7860"] | |