-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (80 loc) · 5.57 KB
/
Dockerfile
File metadata and controls
101 lines (80 loc) · 5.57 KB
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
FROM php:8.4-fpm
#####################################################################################
# #
# Configure env vars and timezone #
# #
#####################################################################################
ARG SYSTEM_TIMEZONE=UTC
ARG PHP_MEMORY_LIMIT=1024M
ARG PHP_ERROR_LOG=/var/www/html/var/php/php.error.log
ENV SYSTEM_TIMEZONE=${SYSTEM_TIMEZONE}
ENV TZ="${SYSTEM_TIMEZONE}"
ENV PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}
ENV PHP_ERROR_LOG=${PHP_ERROR_LOG}
RUN ln -snf /usr/share/zoneinfo/${SYSTEM_TIMEZONE} /etc/localtime && echo ${SYSTEM_TIMEZONE} > /etc/timezone
#####################################################################################
# #
# Setup PHP & Extensions #
# #
#####################################################################################
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -y --no-install-recommends apt-utils autoconf bash-completion \
ca-certificates curl filter ftp gettext git gnupg libbz2-dev libzip-dev \
libbz2-dev libedit2 libfreetype6-dev libxml2 libjpeg62-turbo-dev \
libpng-dev libxslt-dev libonig-dev libwebp-dev libxpm-dev \
libmagickwand-dev libicu-dev make openssl unzip zip zlib1g-dev xz-utils \
xsltproc wget poppler-utils procps supervisor openssh-client supervisor \
ghostscript
RUN docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype \
&& docker-php-ext-install bcmath bz2 gd intl mbstring pdo pdo_mysql \
mysqli pcntl posix sockets xsl zip opcache \
&& pecl install apcu -o -f redis bitset \
&& docker-php-ext-enable apcu redis bitset
ADD php.ini.template /usr/local/etc/php/conf.d/custom.ini
#####################################################################################
# #
# Setup XDebug #
# #
#####################################################################################
RUN pecl install xdebug
ADD xdebug.ini.template /usr/local/etc/php/conf.d/xdebug.ini
#####################################################################################
# #
# Setup Composer #
# #
#####################################################################################
ENV COMPOSER_HOME=/composer
ENV PATH=/composer/vendor/bin:$PATH
ENV COMPOSER_ALLOW_SUPERUSER=1
# Setup the Composer installer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php \
&& mv /var/www/html/composer.phar /usr/local/bin/composer.phar \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer
#####################################################################################
# #
# Dynamic config #
# #
#####################################################################################
# Value below could change based on the PHP version, so it is required to be verified
# after each bump of the PHP version.
ENV PHP_EXTENSION_DIR=/usr/local/lib/php/extensions/no-debug-non-zts-20240924
#####################################################################################
# #
# Install tooling globally #
# #
#####################################################################################
RUN composer global config --no-plugins allow-plugins.infection/extension-installer true && \
composer global require infection/infection maglnet/composer-require-checker icanhazstring/composer-unused phpmetrics/phpmetrics && \
export PATH=~/.config/composer/vendor/bin:$PATH
#####################################################################################
# #
# Finalize setup #
# #
#####################################################################################
RUN git config --global --add safe.directory /var/www/html
WORKDIR /var/www/html