-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy path7.4.Dockerfile
150 lines (128 loc) · 6.59 KB
/
7.4.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
150
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM composer:latest as healthcheckbuilder
RUN composer create-project --no-dev amazeeio/healthz-php /healthz-php v0.0.6
FROM php:7.4.28-fpm-alpine3.15
LABEL org.opencontainers.image.authors="The Lagoon Authors" maintainer="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images" repository="https://github.com/uselagoon/lagoon-images"
ENV LAGOON=php
ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
# Copy commons files
COPY --from=commons /lagoon /lagoon
COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/wait-for /bin/
COPY --from=commons /sbin/tini /sbin/
COPY --from=commons /home /home
# Copy healthcheck files
COPY --from=healthcheckbuilder /healthz-php /healthz-php
RUN fix-permissions /etc/passwd \
&& mkdir -p /home
ENV TMPDIR=/tmp \
TMP=/tmp \
HOME=/home \
# When Bash is invoked via `sh` it behaves like the old Bourne Shell and sources a file that is given in `ENV`
ENV=/home/.bashrc \
# When Bash is invoked as non-interactive (like `bash -c command`) it sources a file that is given in `BASH_ENV`
BASH_ENV=/home/.bashrc
COPY check_fcgi /usr/sbin/
COPY entrypoints /lagoon/entrypoints/
COPY php.ini /usr/local/etc/php/
COPY 00-lagoon-php.ini.tpl /usr/local/etc/php/conf.d/
COPY php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
COPY ssmtp.conf /etc/ssmtp/ssmtp.conf
COPY blackfire.ini /usr/local/etc/php/conf.d/blackfire.disable
RUN apk add --no-cache --virtual .devdeps \
libzip-dev \
# for gd
libpng-dev \
libjpeg-turbo-dev \
# for gettext
gettext-dev \
# for mcrypt
libmcrypt-dev \
# for soap
libxml2-dev \
# for xsl
libxslt-dev \
libgcrypt-dev \
# for webp
libwebp-dev \
postgresql-dev \
# for yaml
yaml-dev \
# for imagemagick
imagemagick-dev \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& yes '' | pecl install -f apcu-5.1.21 \
&& yes '' | pecl install -f imagick-3.7.0 \
&& yes '' | pecl install -f redis-4.3.0 \
&& yes '' | pecl install -f xdebug-3.1.3 \
&& yes '' | pecl install -f yaml-2.2.2 \
&& docker-php-ext-enable apcu imagick redis xdebug yaml \
&& rm -rf /tmp/pear \
&& apk del -r .phpize-deps \
&& sed -i '1s/^/;Intentionally disabled. Enable via setting env variable XDEBUG_ENABLE to true\n;/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& docker-php-ext-configure gd --with-webp --with-jpeg \
&& docker-php-ext-install -j4 bcmath gd gettext mysqli pdo_mysql opcache pdo_pgsql pgsql shmop soap sockets xsl zip \
&& apk del -r .devdeps \
&& apk add --no-cache \
fcgi \
ssmtp \
libzip \
libpng \
libjpeg-turbo \
gettext \
libmcrypt \
libxml2 \
libxslt \
libgcrypt \
libwebp \
postgresql-libs \
yaml \
imagemagick \
imagemagick-libs
# New Relic PHP Agent.
# @see https://docs.newrelic.com/docs/release-notes/agent-release-notes/php-release-notes/
# @see https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements
ENV NEWRELIC_VERSION=9.18.1.303
RUN mkdir -p /tmp/newrelic && cd /tmp/newrelic \
&& wget https://download.newrelic.com/php_agent/archive/${NEWRELIC_VERSION}/newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz \
&& gzip -dc newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz | tar --strip-components=1 -xf - \
&& NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ./newrelic-install install \
&& sed -i -e "s/newrelic.appname = .*/newrelic.appname = \"\${LAGOON_PROJECT:-noproject}-\${LAGOON_GIT_SAFE_BRANCH:-nobranch}\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/;newrelic.enabled = .*/newrelic.enabled = \${NEWRELIC_ENABLED:-false}/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/;newrelic.browser_monitoring.auto_instrument = .*/newrelic.browser_monitoring.auto_instrument = \${NEWRELIC_BROWSER_MONITORING_ENABLED:-true}/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/newrelic.license = .*/newrelic.license = \"\${NEWRELIC_LICENSE:-}\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/;newrelic.loglevel = .*/newrelic.loglevel = \"\${NEWRELIC_LOG_LEVEL:-warning}\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/;newrelic.daemon.loglevel = .*/newrelic.daemon.loglevel = \"\${NEWRELIC_DAEMON_LOG_LEVEL:-warning}\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/newrelic.logfile = .*/newrelic.logfile = \"\/dev\/stderr\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& sed -i -e "s/newrelic.daemon.logfile = .*/newrelic.daemon.logfile = \"\/dev\/stderr\"/" /usr/local/etc/php/conf.d/newrelic.ini \
&& mv /usr/local/etc/php/conf.d/newrelic.ini /usr/local/etc/php/conf.d/newrelic.disable \
&& cd / && rm -rf /tmp/newrelic \
&& fix-permissions /usr/local/etc/
# Add blackfire probe and agent.
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& mkdir -p /blackfire \
&& curl -A "Docker" -o /blackfire/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/$architecture/$version \
&& tar zxpf /blackfire/blackfire-probe.tar.gz -C /blackfire \
&& mv /blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& fix-permissions /usr/local/etc/php/conf.d/
ENV BLACKFIRE_VERSION=2.5.2
RUN architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& curl -A "Docker" -o /blackfire/blackfire-linux_${architecture}.tar.gz -D - -L -s https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${architecture}.tar.gz \
&& tar zxpf /blackfire/blackfire-linux_${architecture}.tar.gz -C /blackfire \
&& mv /blackfire/blackfire /bin/blackfire \
&& chmod +x /bin/blackfire \
&& mkdir -p /etc/blackfire \
&& touch /etc/blackfire/agent \
&& fix-permissions /etc/blackfire/
RUN mkdir -p /app \
&& fix-permissions /app \
&& fix-permissions /etc/ssmtp/ssmtp.conf \
&& fix-permissions /usr/local/etc/
EXPOSE 9000
ENV LAGOON_ENVIRONMENT_TYPE=development
WORKDIR /app
ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"]
CMD ["/usr/local/sbin/php-fpm", "-F", "-R"]