-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
110 lines (78 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
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
#syntax=docker/dockerfile:1.4
# Adapted from https://github.com/dunglas/symfony-docker
# Versions
# hadolint ignore=DL3007
FROM nextcloud:29-fpm AS nextcloud_upstream
FROM composer/composer:2-bin AS composer_upstream
FROM mlocati/php-extension-installer AS php_extension_installer_upstream
# The different stages of this Dockerfile are meant to be built into separate images
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
# https://docs.docker.com/compose/compose-file/#target
# Base nextcloud image
FROM nextcloud_upstream as nextcloud_base
WORKDIR /var/www/html
# persistent / runtime deps
# hadolint ignore=DL3008
RUN apt-get update; \
apt-get install -y --no-install-recommends \
ffmpeg \
procps \
smbclient \
supervisor \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
COPY --from=php_extension_installer_upstream /usr/bin/install-php-extensions /usr/local/bin/
RUN set -eux; \
install-php-extensions \
bz2 \
imap \
smbclient \
;
COPY docker/nextcloud/conf.d/nextcloud.ini $PHP_INI_DIR/conf.d/zzz-nextcloud.ini
COPY docker/nextcloud/php-fpm.d/nextcloud.conf $PHP_INI_DIR/../php-fpm.d/zzz-nextcloud.conf
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"
COPY --from=composer_upstream /composer /usr/bin/composer
###> cron ###
RUN set -eux; \
\
mkdir -p /var/log/supervisord; \
mkdir -p /var/run/supervisord
COPY docker/nextcloud/supervisord.conf /
COPY docker/nextcloud/cron.sh /nextcloud-cron.sh
RUN chmod +x /nextcloud-cron.sh
RUN echo '*/10 * * * * /nextcloud-cron.sh' >> /var/spool/cron/crontabs/www-data
###< cron ###
###> notify_push ###
COPY docker/nextcloud/notify_push.sh /notify_push.sh
RUN set -eux; \
chmod +x /notify_push.sh
EXPOSE 7867
###< notify_push ###
###> custom ###
###< custom ###
ENV NEXTCLOUD_UPDATE=1
COPY docker/nextcloud/entrypoint.sh /nextcloud-entrypoint.sh
RUN chmod +x /nextcloud-entrypoint.sh
ENTRYPOINT ["/nextcloud-entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
# Dev nextcloud image
FROM nextcloud_base AS nextcloud_dev
ENV XDEBUG_MODE=develop
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN apt-get update; \
apt-get install -y --no-install-recommends \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
install-php-extensions \
xdebug \
;
COPY docker/nextcloud/conf.d/nextcloud.dev.ini $PHP_INI_DIR/conf.d/zzz-nextcloud.dev.ini
# Prod nextcloud image
FROM nextcloud_base AS nextcloud_prod
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY docker/nextcloud/conf.d/nextcloud.prod.ini $PHP_INI_DIR/conf.d/zzz-nextcloud.prod.ini