This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Dockerfile
149 lines (140 loc) · 4.11 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
ARG BUILD_DATE
ARG VCS_REF
FROM php:7.4-fpm-alpine
LABEL maintainer="Simon Erhardt <[email protected]>" \
org.label-schema.name="Nextcloud" \
org.label-schema.description="Minimal Nextcloud docker image based on Alpine Linux." \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/chrootLogin/docker-nextcloud" \
org.label-schema.schema-version="1.0"
ARG NEXTCLOUD_GPG="2880 6A87 8AE4 23A2 8372 792E D758 99B9 A724 937A"
ARG NEXTCLOUD_VERSION=21.0.1
ARG UID=1501
ARG GID=1501
RUN set -ex \
# Add user for nextcloud
&& addgroup -g ${GID} nextcloud \
&& adduser -u ${UID} -h /opt/nextcloud -H -G nextcloud -s /sbin/nologin -D nextcloud \
# Install
&& apk update \
&& apk upgrade \
&& apk add \
alpine-sdk \
autoconf \
bash \
freetype \
freetype-dev \
gmp \
gmp-dev \
gnupg \
icu-dev \
icu-libs \
imagemagick \
imagemagick-dev \
libjpeg-turbo \
libjpeg-turbo-dev \
libldap \
libmcrypt \
libmcrypt-dev \
libmemcached \
libmemcached-dev \
libpng \
libpng-dev \
libzip \
libzip-dev \
nginx \
oniguruma \
oniguruma-dev \
openldap-dev \
openssl \
pcre \
pcre-dev \
postgresql-dev \
postgresql-libs \
python3 \
py3-pip \
samba-client \
sudo \
supervisor \
tar \
tini \
wget \
# Python
&& pip3 install --upgrade pip \
&& pip3 install supervisor-stdout \
# PHP Extensions
# https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
&& docker-php-ext-configure gd --with-freetype=/usr --with-jpeg=/usr \
&& docker-php-ext-configure ldap \
&& docker-php-ext-configure zip \
&& docker-php-ext-install \
bcmath \
exif \
gd \
gmp \
intl \
ldap \
mbstring \
mysqli \
opcache \
pcntl \
pdo_mysql \
pdo_pgsql \
pgsql \
zip \
&& pecl channel-update pecl.php.net \
&& pecl install APCu-5.1.19 \
&& pecl install imagick-3.4.4 \
&& pecl install mcrypt-1.0.4 \
&& pecl install memcached-3.1.5 \
&& pecl install redis-5.3.2 \
&& docker-php-ext-enable apcu imagick mcrypt memcached redis \
# Remove dev packages
&& apk del \
alpine-sdk \
autoconf \
freetype-dev \
gmp-dev \
icu-dev \
imagemagick-dev \
libmcrypt-dev \
libmemcached-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
oniguruma-dev \
openldap-dev \
pcre-dev \
postgresql-dev \
&& rm -rf /var/cache/apk/* \
&& mkdir -p /opt/nextcloud \
# Download Nextcloud
&& cd /tmp \
&& NEXTCLOUD_TARBALL="nextcloud-${NEXTCLOUD_VERSION}.tar.bz2" \
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL} \
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL}.sha256 \
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL}.asc \
&& wget -q https://nextcloud.com/nextcloud.asc \
# Verify checksum
&& echo "Verifying both integrity and authenticity of ${NEXTCLOUD_TARBALL}..." \
&& CHECKSUM_STATE=$(echo -n $(sha256sum -c ${NEXTCLOUD_TARBALL}.sha256) | tail -c 2) \
&& if [ "${CHECKSUM_STATE}" != "OK" ]; then echo "Warning! Checksum does not match!" && exit 1; fi \
&& gpg --import nextcloud.asc \
&& FINGERPRINT="$(LANG=C gpg --verify ${NEXTCLOUD_TARBALL}.asc ${NEXTCLOUD_TARBALL} 2>&1 | sed -n "s#Primary key fingerprint: \(.*\)#\1#p")" \
&& if [ -z "${FINGERPRINT}" ]; then echo "Warning! Invalid GPG signature!" && exit 1; fi \
&& if [ "${FINGERPRINT}" != "${NEXTCLOUD_GPG}" ]; then echo "Warning! Wrong GPG fingerprint!" && exit 1; fi \
&& echo "All seems good, now unpacking ${NEXTCLOUD_TARBALL}..." \
# Extract
&& tar xjf ${NEXTCLOUD_TARBALL} --strip-components=1 -C /opt/nextcloud \
# Remove nextcloud updater for safety
&& rm -rf /opt/nextcloud/updater \
&& rm -rf /tmp/* /root/.gnupg \
# Wipe excess directories
&& rm -rf /var/www/*
COPY root /
RUN chmod +x /usr/local/bin/run.sh /usr/local/bin/occ /etc/periodic/15min/nextcloud
VOLUME ["/data"]
EXPOSE 80
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/run.sh"]