29 lines
583 B
Docker
29 lines
583 B
Docker
FROM python:3.8.6-slim as build
|
|
|
|
RUN mkdir /install
|
|
|
|
WORKDIR /install
|
|
|
|
COPY requirements.txt .
|
|
|
|
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
|
|
|
|
# RUN apt-get update \
|
|
# && apt-get install gcc -y \
|
|
# && apt-get clean
|
|
|
|
RUN pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --prefix=/install
|
|
|
|
# 应用启动
|
|
FROM python:3.8.6-slim
|
|
|
|
COPY --from=build /install /usr/local
|
|
|
|
COPY . /app
|
|
|
|
WORKDIR /app
|
|
|
|
ENV FAST_API_ENV=dev
|
|
|
|
CMD ["/usr/local/bin/uvicorn", "main:fast_api_app", "--reload", "--host", "0.0.0.0", "--port", "8000"]
|