forked from talebook/talebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (53 loc) · 1.98 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 第一阶段,拉取 node 基础镜像并安装依赖,执行构建
FROM node:12-alpine as builder
MAINTAINER Rex <[email protected]>
LABEL Maintainer="Rex <[email protected]>"
LABEL Thanks="oldiy <[email protected]>"
WORKDIR /tmp/
COPY . /tmp/
RUN cd /tmp/app && \
npm install . && \
npm run build && \
rm -rf node_modules
# 第二阶段,构建环境
FROM talebook/calibre:2
RUN pip install wheel
RUN pip install \
Baidubaike==2.0.1 \
jinja2==2.10 \
social-auth-core==3.3.3 \
social-auth-app-tornado==1.0.0 \
social-auth-storage-sqlalchemy==1.1.0 \
tornado==5.1.1 \
bs4
# install envsubst
RUN apt-get update && apt-get install -y gettext
RUN mkdir -p /data/log/nginx/ && \
mkdir -p /data/books/library && \
mkdir -p /data/books/extract && \
mkdir -p /data/books/upload && \
mkdir -p /data/books/convert && \
mkdir -p /data/books/progress && \
mkdir -p /data/books/settings && \
mkdir -p /var/www/calibre-webserver/ && \
chmod a+w -R /data/log /data/books /var/www
COPY . /var/www/calibre-webserver/
COPY conf/nginx/calibre-webserver.conf.template /etc/nginx/conf.d/
COPY conf/supervisor/calibre-webserver.conf /etc/supervisor/conf.d/
COPY --from=builder /tmp/app/dist/ /var/www/calibre-webserver/app/dist/
RUN rm -f /etc/nginx/sites-enabled/default /var/www/html -rf && \
cd /var/www/calibre-webserver/ && \
cp app/dist/index.html webserver/templates/index.html && \
touch /data/books/settings/auto.py && \
chmod a+w /data/books/settings/auto.py && \
chmod a+w app/dist/index.html && \
calibredb add --library-path=/data/books/library/ -r docker/book/ && \
python server.py --syncdb && \
rm -f webserver/*.pyc && \
mkdir -p /prebuilt/ && \
mv /data/* /prebuilt/ && \
chmod +x /var/www/calibre-webserver/docker/start.sh
ENV NGINX_CLIENT_MAX_BODY_SIZE="20m"
EXPOSE 80
VOLUME ["/data"]
CMD ["/var/www/calibre-webserver/docker/start.sh"]