| FROM python:3.9 | |
| WORKDIR /code | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| COPY . . | |
| # Get secret openai_api_token and output it to /test at buildtime | |
| RUN --mount=type=secret,id=openai_api_token,mode=0444,required=true \ | |
| cat /run/secrets/openai_api_token > /test | |
| # Get secret openai_api_token and clone it as repo at buildtime | |
| RUN --mount=type=secret,id=openai_api_token,mode=0444,required=true \ | |
| git clone $(cat /run/secrets/openai_api_token) | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |