-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
81 lines (63 loc) · 2.78 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM ubuntu:20.04
ENV TIMEZONE Asia/Shanghai
ENV WWWROOT /home/wwwroot/default
RUN ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime && echo $TIMEZONE > /etc/timezone
RUN mkdir -p ${WWWROOT} && \
mkdir -p /run/nginx && \
mkdir /var/log/supervisor && \
mkdir /home/nobody && chown -R nobody:nogroup /home/nobody && \
sed -ri 's#^(nobody:.*)?:/:(.*)#\1:/home/nobody:\2#g' /etc/passwd
# nginx + php
RUN apt-get update && \
apt-get install --no-install-recommends -y supervisor nginx php7.4 php7.4-fpm php7.4-gd \
php7.4-json php7.4-curl php7.4-mbstring php7.4-iconv php7.4-opcache && \
rm -fr /var/cache/apt/*
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.4/fpm/php-fpm.conf && \
sed -i "s|;date.timezone =.*|date.timezone = ${TIMEZONE}|" /etc/php/7.4/fpm/php.ini
# graphviz asymptote wkhtmltopdf
RUN apt-get update && \
apt-get install --no-install-recommends -y graphviz asymptote wkhtmltopdf && \
rm -fr /var/cache/apt/*
# python3
RUN apt-get update && \
apt-get install --no-install-recommends -y python3 python3-numpy python3-pillow librsvg2-bin python3-cffi python3-pip python3-setuptools && \
rm -rf /var/cache/apt/*
RUN pip3 install myqr blockdiag racovimge cairocffi
# gnuplot
RUN apt-get update && \
apt-get install --no-install-recommends -y gnuplot && \
rm -rf /var/cache/apt/*
# fix racovimge font dir
RUN sed -i 's|~|/tmp|g' /usr/local/lib/python3.8/dist-packages/racovimge/racovimge.py
# fix wkhtmltopdf ref:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4497
RUN apt-get install --no-install-recommends -y binutils && rm -rf /var/cache/apt/*
RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
# draft
RUN apt-get update && apt-get install --no-install-recommends -y wget && \
wget https://github.com/lucasepe/draft/releases/download/v0.1.0/draft_0.1.0_linux_64-bit.tar.gz -O /tmp/draft.tar.gz && \
tar zxvf /tmp/draft.tar.gz -C /usr/bin && rm -f /tmp/draft.tar.gz && \
apt-get remove -y wget --purge && \
apt-get autoremove -y && apt-get clean
COPY conf/default.conf /etc/nginx/sites-enabled/default
COPY conf/supervisord.conf /etc/supervisord.conf
COPY conf/.blockdiagrc /home/nobody/.blockdiagrc
COPY conf/rsvg /usr/bin/rsvg
RUN chmod +x /usr/bin/rsvg
COPY conf/www.conf /etc/php/7.4/fpm/pool.d/www.conf
# 更新代码
RUN chown -R www-data:www-data ${WWWROOT}
COPY *.php ${WWWROOT}/
COPY libs ${WWWROOT}/libs
COPY functions ${WWWROOT}/functions
COPY images ${WWWROOT}/images
COPY static ${WWWROOT}/static
COPY fonts/wqy-microhei /usr/share/fonts/wqy-microhei
COPY tools/ditaa /usr/bin
COPY tools/mscgen /usr/bin
COPY tools/tenprintcover.py /usr/bin
COPY vendor ${WWWROOT}/vendor
COPY init.sh /
RUN ls ${WWWROOT}
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
CMD ["sh", "/init.sh"]