| ## Use official py3.9 | |
| FROM python:3.9 | |
| ## Set the workdir | |
| WORKDIR /code | |
| ## CPY | |
| COPY ./requirements.txt /code/requirements.txt | |
| ## Install | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| ## Set up a new user | |
| USER user | |
| # Set env | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Setr Wrkdir | |
| WORKDIR $HOME/app | |
| # copy | |
| COPY --chown=user . $HOME/app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |