python:alpine
基于 Python3, 依赖下载过程中需要 build, 安装python3-dev
,build-base
,gcc
, build 完后删掉, 镜像可减少几百 M
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| FROM python:alpine
LABEL maintainer="linweiyuan <root@linweiyuan.com>"
ENV FOLDER 项目名字
COPY . ${FOLDER}
WORKDIR ${FOLDER}
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \ && apk add --no-cache python3-dev build-base gcc \ && pip install --no-cache-dir -r requirements.txt \ && apk del python3-dev build-base gcc
EXPOSE 5000
CMD ["flask","run","--host=0.0.0.0"]
|