mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-13 15:09:18 +00:00
change dockerfile
This commit is contained in:
48
Dockerfile
48
Dockerfile
@@ -1,32 +1,30 @@
|
|||||||
# 使用基础镜像库
|
# nginx-gunicorn-flask
|
||||||
FROM alpine:3.8
|
|
||||||
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.7/main/ > /etc/apk/repositories
|
|
||||||
|
|
||||||
RUN apk add --no-cache vim nginx python3 uwsgi uwsgi-python3
|
FROM ubuntu:latest
|
||||||
RUN apk add --update --upgrade
|
MAINTAINER Hiller Liao <hillerliao@163.com>
|
||||||
RUN apk add --no-cache nginx python3 uwsgi uwsgi-python3
|
|
||||||
RUN pip3 install --no-cache-dir --upgrade pip
|
|
||||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y python3 python3-pip python3-virtualenv nginx supervisor
|
||||||
|
|
||||||
# 创建工作路径
|
# Setup flask application
|
||||||
RUN mkdir /app
|
RUN mkdir -p /app
|
||||||
|
COPY . /app
|
||||||
|
RUN pip install -r /app/requirements.txt -i https://mirrors.aliyun.com/pypi/simple
|
||||||
|
RUN pip install gunicorn
|
||||||
|
# RUN pip install git+https://github.com/getsyncr/notion-sdk.git
|
||||||
|
|
||||||
# 指定容器启动时执行的命令都在app目录下执行
|
# Setup nginx
|
||||||
WORKDIR /app
|
RUN rm /etc/nginx/sites-enabled/default
|
||||||
|
COPY flask.conf /etc/nginx/sites-available/
|
||||||
|
RUN ln -s /etc/nginx/sites-available/flask.conf /etc/nginx/sites-enabled/flask.conf
|
||||||
|
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# 替换nginx的配置
|
# Setup supervisord
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
RUN mkdir -p /var/log/supervisor
|
||||||
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
COPY gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf
|
||||||
|
|
||||||
# 将本地目录下的内容拷贝到容器的app目录下
|
# Start processes
|
||||||
COPY . /app/
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
|
||||||
RUN apk update
|
|
||||||
RUN apk add --no-cache gcc musl-dev libxml2 libxslt-dev
|
|
||||||
# pip读取requirements.txt内容安装所需的库
|
|
||||||
RUN pip install -r /app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple some-package --no-cache-dir
|
|
||||||
|
|
||||||
# 启动nginx和uwsgi
|
|
||||||
# ENTRYPOINT nginx -g "daemon on;" && uwsgi --ini /app/uwsgi.ini
|
|
||||||
ENTRYPOINT nginx -g "daemon on;" && gunicorn -w 4 wsgi:app
|
|
||||||
|
|||||||
32
Dockerfile.old
Normal file
32
Dockerfile.old
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# 使用基础镜像库
|
||||||
|
FROM alpine:3.8
|
||||||
|
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.7/main/ > /etc/apk/repositories
|
||||||
|
|
||||||
|
RUN apk add --no-cache vim nginx python3 uwsgi uwsgi-python3
|
||||||
|
RUN apk add --update --upgrade
|
||||||
|
RUN apk add --no-cache nginx python3 uwsgi uwsgi-python3
|
||||||
|
RUN pip3 install --no-cache-dir --upgrade pip
|
||||||
|
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 创建工作路径
|
||||||
|
RUN mkdir /app
|
||||||
|
|
||||||
|
# 指定容器启动时执行的命令都在app目录下执行
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 替换nginx的配置
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# 将本地目录下的内容拷贝到容器的app目录下
|
||||||
|
COPY . /app/
|
||||||
|
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add --no-cache gcc musl-dev libxml2 libxslt-dev
|
||||||
|
# pip读取requirements.txt内容安装所需的库
|
||||||
|
RUN pip install -r /app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple some-package --no-cache-dir
|
||||||
|
|
||||||
|
# 启动nginx和uwsgi
|
||||||
|
# ENTRYPOINT nginx -g "daemon on;" && uwsgi --ini /app/uwsgi.ini
|
||||||
|
ENTRYPOINT nginx -g "daemon on;" && gunicorn -w 4 wsgi:app
|
||||||
8
flask.conf
Normal file
8
flask.conf
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:5000/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
gunicorn.conf
Normal file
3
gunicorn.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[program:gunicorn]
|
||||||
|
command=/usr/local/bin/gunicorn wsgi:app -b localhost:5000
|
||||||
|
directory=/deploy/app
|
||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
5
supervisord.conf
Normal file
5
supervisord.conf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=/usr/sbin/nginx
|
||||||
Reference in New Issue
Block a user