# Stage 1: Build stage FROM python:3.9 AS builder # Install git RUN apt-get update && \ apt-get install -y git # Set working directory WORKDIR /code # Copy requirements file COPY ./requirements.txt /code/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Stage 2: Runtime stage FROM python:3.9 # Set working directory WORKDIR /code # Copy from the builder stage COPY --from=builder /code /code # Set environment variable for GitHub token (replace with your actual token) ARG GH_TOKEN ENV gh_token=${GH_TOKEN} # Clone your repository using the token RUN url_with_token="https://$gh_token@github.com/yourusername/your-repo.git" && \ git clone $url_with_token /code # Set the working directory to your cloned repository WORKDIR /code # Install remaining dependencies (if any) RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Command to run your application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]