FROM python:3.8 AS pipenv_build
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&
pip install pipenv
COPY ./Pipfile* /tmp/
RUN cd /tmp &&
pipenv lock --requirements > requirements.txt
# ==========
FROM python:3.8
WORKDIR /src
COPY --from=pipenv_build /tmp/requirements.txt .
RUN pip install -r requirements.txt
ADD . .
CMD uvicorn server:app --host=0.0.0.0 --port=5000