python Dockerfile和docker-compose.yml模板
FROM python:3.7
WORKDIR /code

COPY requirements.txt ./
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

COPY . .
WORKDIR /code/flask

CMD ["gunicorn", "myapp:my_app", "-c", "./gun.py"]

Dockerfile 如上: 

docker-compose.yml 如下:

version: "3"
services:
  web_flask:
    restart: always
    image: py_pro
    volumes:
      - .:/code
      - ./log:/logs
      - /etc/localtime:/etc/localtime
      - /root/sdk/platform/storage/material:/material
    ports:
      - "8868:8800"

 

posted on 2020-09-16 09:51  旧楚布衣  阅读(306)  评论(0编辑  收藏  举报