python 版本:3.6.8 / 3.8.1
使用例子:
docker run -d --name publish \
-v $(pwd)/publish:/webroot \
-p 8000:8000 -p 8001:8001 \
--restart=always \
--link=mariadb:mariadb \
--link=redis:redis \
pcloth/python-nginx-supervisord:3.6.8 \
sh -c "pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple && \
supervisord -c conf/supervisor.conf && \
while true; do echo hello world; sleep 60; done"
/webroot是容器内web项目的根目录,也是当前活动目录,你需要把你的项目目录隐射到容器。
容器内已经安装好nginx和supervisord ,你可以把配置内容也放到/webroot,然后使用supervisord 调用它们。
最新tag:py36-wait 添加了docker-compose-wait 2.5.1 https://github.com/ufoscout/docker-compose-wait/releases/download/2.5.1/wait 用于等待其他容器完成后在执行某些代码。
FROM python:3.8.1
COPY ./webroot /webroot
# 启用清华apt源
RUN sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && apt-get update
# 安装nginx和supervisor
RUN apt-get install -y \
vim \
nano \
nginx \
supervisor
WORKDIR /webroot
# 添加一个nginx的用户,方便nginx启动
RUN adduser --system --no-create-home --disabled-password --group nginx
# 调整到中国上海时区
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 添加wait脚本,用来确保其他容器的服务启动完后再执行后面的command
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.5.1/wait /wait
RUN chmod +x /wait
CMD ["python"]
Content type
Image
Digest
sha256:701a6d2f8…
Size
435.5 MB
Last updated
over 1 year ago
docker pull pcloth/python-nginx-supervisord:py3.13.3-wait