-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
78 lines (70 loc) · 2.94 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
ARG PHP_VERSION=8.3
ARG PHP_EXTRA_BUILD_DEPS=""
# https://hub.docker.com/_/joomla
ARG JOOMLA_VERSION=5.2.3
FROM joomla:${JOOMLA_VERSION}-apache AS joomla
# https://hub.docker.com/_/php
FROM php:${PHP_VERSION}-apache
ENV LANG=en_US.UTF-8
# hadolint ignore=SC2086
RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
set -eux; \
apt-get update; \
# install the system tools we need
apt-get install -y --no-install-recommends mariadb-client; \
# install the PHP extensions we need
savedAptMark="$(apt-mark showmanual)"; \
apt-get install -y --no-install-recommends \
libfreetype6-dev libicu-dev libssl-dev \
libjpeg62-turbo-dev libpng-dev \
libxml2-dev libxslt1-dev \
libzip-dev libwebp-dev \
${PHP_EXTRA_BUILD_DEPS:-}; \
# https://www.php.net/manual/en/image.installation.php
docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j$(nproc) ftp \
gd intl mysqli opcache pcntl pdo_mysql soap xsl zip; \
curl -Lo /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
chmod +x /usr/local/bin/pickle; \
pickle install --no-interaction apcu-stable; \
pickle install --no-interaction redis-stable; \
pickle install --no-interaction xdebug-stable; \
docker-php-ext-enable apcu opcache redis xdebug; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /tmp/*;
# set up Apache2
RUN set -eux; \
# enable Apache2 modules
a2enmod rewrite expires include deflate remoteip headers; \
{ \
# disable Apache2 server signature
echo 'ServerSignature Off'; \
echo 'ServerTokens Prod'; \
# enable support for TLS termination
echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on'; \
} >> /etc/apache2/apache2.conf;
# install composer
# https://hub.docker.com/_/composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# set up Joomla!
# Disable remote database security requirements.
ENV JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK=1
COPY --from=joomla /entrypoint.sh /
COPY --from=joomla /makedb.php /
COPY --from=joomla --chown=www-data:www-data /usr/src/joomla /usr/src/joomla
RUN set -eux; \
chown -R www-data:www-data /usr/src/joomla; \
chmod -R g+w /usr/src/joomla;
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "apache2-foreground" ]