-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile_caddy
113 lines (100 loc) · 4.72 KB
/
Dockerfile_caddy
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
FROM alpine:latest
LABEL MAINTAINER='Pawel Kostelnik <[email protected]>' \
Description="Lightweight container with Caddyserver 2.3, PHP-FPM 7.4 and open3A 3.3 based on Alpine Linux."
### Copy config files for php-fpm and php inplace
# Configure PHP-FPM
#COPY config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
COPY config/php.ini /etc/php7/conf.d/custom.ini
# Configure supervisord
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# https://github.com/caddyserver/caddy/releases
ENV CADDY_VERSION v2.3.0
RUN apk update \
&& apk upgrade \
&& apk add --no-cache ca-certificates nano unzip aria2 supervisor php7 \
php7-mysqli \
php7-bcmath \
php7-ctype \
php7-curl \
php7-fpm \
php7-gd \
php7-iconv \
php7-intl \
php7-json \
php7-mbstring \
php7-mcrypt \
php7-mysqlnd \
php7-opcache \
php7-openssl \
php7-pdo \
php7-pdo_mysql \
php7-pdo_pgsql \
php7-pdo_sqlite \
php7-phar \
php7-posix \
php7-session \
php7-soap \
php7-xml \
php7-zip \
&& mkdir -p /tmp \
&& aria2c "https://www.open3a.de/download/open3A 3.3.zip" -d /tmp -o open3A.zip \
&& unzip /tmp/open3A.zip -d /srv \
&& chmod 777 /srv/specifics \
&& chmod 777 /srv/system/Backup \
&& mkdir /srv/system/session \
&& chmod 777 /srv/system/session \
&& chmod 777 /srv/system/DBData/Installation.pfdb.php \
# Remove unnecessary services
&& rm -f /etc/init.d/hwdrivers \
/etc/init.d/hwclock \
/etc/init.d/hwdrivers \
/etc/init.d/modules \
/etc/init.d/modules-load \
/etc/init.d/modloop \
&& set -eux; \
mkdir -p \
/config/caddy \
/data/caddy \
/etc/caddy \
/usr/share/caddy \
; \
wget -O /etc/caddy/Caddyfile "https://github.com/caddyserver/dist/raw/56302336e0bb7c8c5dff34cbcb1d833791478226/config/Caddyfile"; \
wget -O /usr/share/caddy/index.html "https://github.com/caddyserver/dist/raw/56302336e0bb7c8c5dff34cbcb1d833791478226/welcome/index.html" \
&& set -eux; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) binArch='amd64'; checksum='7112a03bf341a4ccc5332b5ea715de9a68316d2aa2f468bdc263b192448ce412e002acfda68bd0606088b35c5de1f2e93f2aa64ccc065a039f87ee34e0b85b98' ;; \
armhf) binArch='armv6'; checksum='a597dbfbd277648881cf51739382a509e5014b3342c78e444f6a680f93836d46c12fc1294e200358fd4a0a40688c5582c81bff14dffd0bba5303170a4d274014' ;; \
armv7) binArch='armv7'; checksum='99e7703ffa9dd8f636f4624c0972fd3d4af01523953ebf487b919ce93e1989b5513785dd9e902326423eb334bb22dddbcccab382f46763ec11c43c9e513f7c38' ;; \
aarch64) binArch='arm64'; checksum='ef1e44293a935b05602524dbab96b51c862864b8a36c7de48b3329dab9b8a4b7d1930460868fded3afb3a74bdfb5a1c1c0ba46f1401edf648a370c0f7be8a05b' ;; \
ppc64el|ppc64le) binArch='ppc64le'; checksum='62e4a191cae8a1a023ab2653b76439cd4182ca49af4f00bff56507f9f1f4af3e72716a59c59ff157efa87c655110fb2491125baae72590719870dc795d19538d' ;; \
s390x) binArch='s390x'; checksum='48cac248c29218e153d76408b172510f4f02e3fe7f7b2209371d2c69ed46d2bfa1f572f46390a00eda6f9296a8cac744a36e21cae6df791bd9d98f22b43ea42b' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
esac; \
wget -O /tmp/caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v2.3.0/caddy_2.3.0_linux_${binArch}.tar.gz"; \
echo "$checksum /tmp/caddy.tar.gz" | sha512sum -c; \
tar x -z -f /tmp/caddy.tar.gz -C /usr/bin caddy; \
rm -f /tmp/caddy.tar.gz; \
chmod +x /usr/bin/caddy; \
caddy version \
&& [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
# See https://caddyserver.com/docs/conventions#file-locations for details
ENV XDG_CONFIG_HOME /config
ENV XDG_DATA_HOME /data
VOLUME /config
VOLUME /data
LABEL org.opencontainers.image.version=v2.3.0
LABEL org.opencontainers.image.title=Caddy
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
LABEL org.opencontainers.image.url=https://caddyserver.com
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
LABEL org.opencontainers.image.vendor="Light Code Labs"
LABEL org.opencontainers.image.licenses=Apache-2.0
LABEL org.opencontainers.image.source="https://github.com/caddyserver/caddy-docker"
COPY Caddyfile /etc/caddy/Caddyfile
HEALTHCHECK --start-period=20s --interval=45s --timeout=3s CMD wget http://localhost/ -O /dev/null || exit 1
EXPOSE 80
EXPOSE 443
EXPOSE 2019
WORKDIR /srv
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile", "&&", "/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf", "&&", "php-fpm7", "-D", "-F"]