python3 程序 Dockerfile 基礎模板

python3 程序 Dockerfile 基礎模板

FROM python:3.7.5-slim-buster

COPY sources.list /etc/apt/sources.list

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONIOENCODING=UTF-8
ENV TZ=Asia/Shanghai
ENV PROJECT_DIR=/data/scrapy/source_spider

# COPY ./ $PROJECT_DIR

# COPY ./.env_sample $PROJECT_DIR/.env

WORKDIR $PROJECT_DIR

RUN apt-get install apt-transport-https ca-certificates

RUN apt update && apt install -y tzdata locales gcc && pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

RUN echo "Asia/Shanghai" > /etc/timezone && rm -f /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

ENV PYTHONPATH=$PYTHONPATH:$PROJECT_DIR

# 文件映射
#VOLUME /data/scrapy/source_spider

你可能感兴趣的:(python,docker,dockerfile,自動化部署)