Spaces:
Running
Running
| # syntax=docker/dockerfile:1.4 | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install necessary dependencies | |
| RUN apt-get update && apt-get install -y git | |
| # Upgrade pip to the latest version | |
| RUN pip install --upgrade pip | |
| # Create necessary directories and set permissions | |
| RUN mkdir -p /app && chmod -R 777 /app | |
| # Clone private repository using mounted secret | |
| RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \ | |
| git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/pdpredict.git . | |
| # Copy the static directory into the container | |
| COPY static /app/static | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Expose the port for FastAPI | |
| EXPOSE 7860 | |
| # Run the FastAPI app with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |