本进行镜像配置了以下服务
nginx
uWSGI
supervisor
FROM kkbblzq/base-uwsgi-python3:0.1
# 复制应用的nginx配置
COPY demo_app.conf /etc/nginx/conf.d/demo_app.conf
# 安装python程序依赖
COPY ./app/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt --no-cache-dir
# 设置 uwsgi.ini 路径
ENV UWSGI_INI /app/uwsgi.ini
# 设置应用
COPY ./app /app
WORKDIR /app
# 启动应用
CMD ["/usr/bin/supervisord"]
需要对应用编写一个nginx的vhost配置拷贝到/etc/nginx/conf.d/目录下
例
server {
listen 5015;
charset utf-8;
client_max_body_size 75M;
location / {
include uwsgi_params;
uwsgi_pass unix:///var/run/mysite.sock;
}
}
当然你也可以直接覆盖完整nginx配置
uWSGI
/etc/uwsgi/uwsgi.ini
nginx
/etc/nginx/nginx.conf
supervisor
/etc/supervisor.d/supervisord.ini