Spaces:
Sleeping
Sleeping
| # Use the official Python image as a base image | |
| FROM python:3.12-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Install system dependencies if required (optional, but good practice) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file into the container | |
| COPY requirements.txt /app/ | |
| # Install the Python dependencies | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application source code | |
| COPY . /app/ | |
| # Expose the port that the application will listen on | |
| EXPOSE 7860 | |
| # Run the FastAPI application using Uvicorn | |
| CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"] | |