-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
92 lines (74 loc) · 4.29 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
# syntax=docker/dockerfile:1
ARG BASE_FRANKENPHP_IMAGE
ARG BASE_JOOMLA_IMAGE
ARG USER=www-data
FROM ${BASE_FRANKENPHP_IMAGE} as common
# install the PHP extensions we need (https://downloads.joomla.org/technical-requirements)
RUN --mount=type=cache,target=/usr/local/etc/php/conf.d/ \
install-php-extensions \
bcmath \
bz2 \
gd \
intl \
mysqli \
opcache \
zip
# Intermediate dependencies
FROM $BASE_JOOMLA_IMAGE AS joomla_dependencies
FROM common AS builder
RUN --mount=type=cache,target=/usr/local/etc/php/conf.d/ \
--mount=type=cache,target=/usr/local/bin \
--mount=type=cache,target=/usr/src/joomla \
mkdir -p /usr/src/joomla
COPY --from=joomla_dependencies /usr/local/etc/php/conf.d/* /usr/local/etc/php/conf.d/
COPY --from=joomla_dependencies --chmod=770 /entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --from=joomla_dependencies /makedb.php /usr/local/bin/makedb.php
COPY --from=joomla_dependencies /usr/src/joomla /usr/src/joomla
COPY ./zzz-custom.ini /usr/local/etc/php/conf.d/zzz-custom.ini
COPY --chmod=770 ./install-japp.sh /usr/local/bin/install-japp.sh
VOLUME /usr/src/joomla
VOLUME /app/public
RUN sed -i \
-e 's#set \-e#set \-e \&\& cd /usr/src/joomla#' \
-e 's#/makedb\.php#/usr/local/bin/makedb\.php#g' \
-e 's# \=\= php\-fpm# \=\= \"\/usr\/local\/bin\/install\-japp\.sh\"#' \
-e 's#\-\-db\-encryption\=0#-\-db\-encryption\=0 -\-public\-folder\=\"\$\{JOOMLA_PUBLIC_FOLDER\:\-\/app\/public\}\"#' \
/usr/local/bin/entrypoint.sh
FROM common AS runner
ARG USER
# Specific php extensions loading
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-fpm.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-bz2.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-gd.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-intl.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/docker-php-ext-zip.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/error-logging.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/opcache-recommended.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/etc/php/conf.d/zzz-custom.ini /usr/local/etc/php/conf.d/
COPY --from=builder --chown=${USER}:${USER} /usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --from=builder --chown=${USER}:${USER} /usr/local/bin/makedb.php /usr/local/bin/makedb.php
COPY --from=builder --chown=${USER}:${USER} /usr/src/joomla /usr/src/joomla
COPY --from=builder --chown=${USER}:${USER} /usr/local/bin/install-japp.sh /usr/local/bin/install-japp.sh
COPY --from=common --chown=${USER}:${USER} /usr/local/bin/frankenphp /usr/local/bin/frankenphp
COPY --chown=${USER}:${USER} ./Caddyfile /etc/caddy/Caddyfile
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp && \
usermod --shell /bin/bash ${USER} && \
mkdir -p /app/public && \
rm -rf /app/public/* && \
rm -rf /app/public/index.php && \
chown -Rc ${USER}:${USER} /etc/caddy /data/caddy /config/caddy /app/public && \
chmod 775 /app/public
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 443/udp
EXPOSE 2019/tcp
VOLUME /usr/src/joomla
VOLUME /app/public
USER ${USER}
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
CMD [ "/usr/local/bin/install-japp.sh" ]
WORKDIR /app/public
HEALTHCHECK CMD curl -f http://localhost:2019/metrics || exit