-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile-standalone
97 lines (80 loc) 路 3.62 KB
/
Dockerfile-standalone
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
FROM php:8.2-fpm-alpine
LABEL org.opencontainers.image.authors="tchap@tchap.me"
LABEL org.opencontainers.image.url="https://github.com/tchapi/davis/pkgs/container/davis-standalone"
LABEL org.opencontainers.image.description="A simple, fully translatable admin interface for sabre/dav based on Symfony 5 and Bootstrap 4 (Standalone version with reverse-proxy)"
# Run update, and gets basic packages and packages for runtime
RUN apk --no-progress --update add --no-cache \
curl unzip \
# These are for php-intl
icu-libs \
# This one is for IMAP (to provide libc-client.so)
c-client \
# This one for LDAP
libldap \
# These are for GD (map image in mail)
freetype \
libjpeg-turbo \
libpng \
# This is for PostgreSQL
libpq \
# For the webserver and process manager
caddy supervisor
# Intl support
RUN apk --update --virtual build-deps-intl add --no-cache icu-dev \
&& docker-php-ext-install intl \
&& apk del build-deps-intl \
&& rm -rf /tmp/*
# PDO: MySQL
RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-install pdo_mysql
# PDO: PostgreSQL
RUN apk --update --virtual build-deps-pg add --no-cache libpq-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pgsql pdo_pgsql \
&& apk del build-deps-pg \
&& rm -rf /tmp/*
# GD (map image in mail)
RUN apk --update --virtual build-deps-gd add --no-cache freetype-dev libjpeg-turbo-dev libpng-dev \
&& docker-php-ext-configure gd --with-freetype \
&& docker-php-ext-install gd \
&& docker-php-ext-enable gd \
&& apk del build-deps-gd \
&& rm -rf /tmp/*
# LDAP auth support
RUN apk --update --virtual build-deps-ldap add --no-cache openldap-dev \
&& docker-php-ext-configure ldap \
&& docker-php-ext-install ldap \
&& apk del build-deps-ldap \
&& rm -rf /tmp/*
# IMAP auth support
RUN apk --update --virtual build-deps-imap add --no-cache imap-dev openssl-dev krb5-dev \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap \
&& apk del build-deps-imap \
&& rm -rf /tmp/*
# Davis source
# The app folder needs to be owned by www-data so PHP-fpm can execute files
ADD --chown=www-data:www-data . /var/www/davis
WORKDIR /var/www/davis
# Install Composer 2, then dependencies
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN APP_ENV=prod COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
# Caddy: web server
RUN mkdir -p /var/log/caddy
ADD ./docker/configurations/Caddyfile /etc/caddy/Caddyfile
# Supervisor: Process manager
RUN mkdir -p /var/log/supervisor && mkdir -p /var/log/php-fpm
ADD ./docker/configurations/supervisord.conf /etc/supervisord.conf
# We want to use sockets inside the container between Caddy and PHP-fpm
RUN mkdir /var/run/php-fpm && chown -R www-data:www-data /var/run/php-fpm
RUN sed -i 's/listen = /;listen = /' /usr/local/etc/php-fpm.d/www.conf
RUN sed -i 's/listen = 9000/listen = \/var\/run\/php-fpm\/php-fpm.sock/' /usr/local/etc/php-fpm.d/zz-docker.conf
# Cleanup (only useful when using --squash)
RUN docker-php-source delete && \
rm -rf /usr/local/bin/composer && \
rm -rf /var/www/davis/docker
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
HEALTHCHECK --interval=120s --timeout=10s --start-period=30s --retries=3 \
CMD curl --fail http://localhost:9000 || exit 1
# It's the Caddy port, not the PHP-fpm one (as we use sockets)
EXPOSE 9000