| # Use the official Python image as the base image | |
| FROM python:3.9-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set the working directory | |
| WORKDIR /app | |
| # Ensure that the /tmp/.cache and /.cache directories are writable | |
| RUN mkdir -p /tmp/.cache/gdown && mkdir -p /.cache/gdown && chmod -R 777 /tmp/.cache /tmp/.cache/gdown /.cache /.cache/gdown | |
| # Install required system dependencies (if any) | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements.txt into the container | |
| COPY requirements.txt /app/ | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . /app/ | |
| # Expose the default FastAPI port | |
| EXPOSE 7860 | |
| # Set the command to start the FastAPI app | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |