1、
sh build.sh
docker build -t py_server:1.0 .
2、Dockerfile
from python:3.7-slim
# 关键一行
RUN apt-get update && apt-get install -y python3-pip python3-dev
RUN pip3 install --upgrade cython
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ Django==3.2.12
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ requests==2.27.1
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ django-cors-headers
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ djangorestframework
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ django-db-connection-pool==1.2.1
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pyyaml
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ elasticsearch==7.12.0
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pymysql==1.0.2
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ SQLAlchemy&