-
Notifications
You must be signed in to change notification settings - Fork 92
/
Dockerfile
156 lines (126 loc) · 6 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
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
151
152
153
154
155
156
FROM php:7.3-fpm
RUN apt-get update -y
RUN apt-get -y install gcc make autoconf libc-dev pkg-config libzip-dev
RUN apt-get install -y --no-install-recommends \
git \
libmemcached-dev \
libz-dev \
libpq-dev \
libssl-dev libssl-doc libsasl2-dev \
libmcrypt-dev \
libxml2-dev \
zlib1g-dev libicu-dev g++ \
libldap2-dev libbz2-dev \
curl libcurl4-openssl-dev \
libenchant-dev libgmp-dev firebird-dev libib-util \
re2c libpng++-dev \
libwebp-dev libjpeg-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libvpx-dev libfreetype6-dev \
libmagick++-dev \
libmagickwand-dev \
zlib1g-dev libgd-dev \
libtidy-dev libxslt1-dev libmagic-dev libexif-dev file \
sqlite3 libsqlite3-dev libxslt-dev \
libmhash2 libmhash-dev libc-client-dev libkrb5-dev libssh2-1-dev \
unzip libpcre3 libpcre3-dev \
poppler-utils ghostscript libmagickwand-6.q16-dev libsnmp-dev libedit-dev libreadline6-dev libsodium-dev \
freetds-bin freetds-dev freetds-common libct4 libsybdb5 tdsodbc libreadline-dev librecode-dev libpspell-dev
# fix for docker-php-ext-install pdo_dblib
# https://stackoverflow.com/questions/43617752/docker-php-and-freetds-cannot-find-freetds-in-know-installation-directories
RUN ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/
RUN docker-php-ext-configure hash --with-mhash && \
docker-php-ext-install hash
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install imap iconv
RUN docker-php-ext-install bcmath bz2 calendar ctype curl dba dom enchant
RUN docker-php-ext-install fileinfo exif ftp gettext gmp
RUN docker-php-ext-install interbase intl json ldap mbstring mysqli
RUN docker-php-ext-install opcache pcntl pspell
RUN docker-php-ext-install pdo pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql phar posix
RUN docker-php-ext-install readline recode
RUN docker-php-ext-install session shmop simplexml soap sockets sodium
RUN docker-php-ext-install sysvmsg sysvsem sysvshm
# RUN docker-php-ext-install snmp
# fix for docker-php-ext-install xmlreader
# https://github.com/docker-library/php/issues/373
RUN export CFLAGS="-I/usr/src/php" && docker-php-ext-install xmlreader xmlwriter xml xmlrpc xsl
RUN docker-php-ext-install tidy tokenizer wddx zend_test zip
# already build in... what they say...
# RUN docker-php-ext-install filter reflection spl standard
# RUN docker-php-ext-install pdo_firebird pdo_oci
# install pecl extension
RUN pecl install ds && \
pecl install imagick && \
pecl install igbinary && \
pecl install redis && \
pecl install memcached && \
docker-php-ext-enable ds imagick igbinary redis memcached
# https://serverpilot.io/docs/how-to-install-the-php-ssh2-extension
# pecl install ssh2-1.1.2 && \
# docker-php-ext-enable ssh2
# install pecl extension
RUN pecl install mongodb && docker-php-ext-enable mongodb
# install xdebug
# RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN yes "" | pecl install msgpack && \
docker-php-ext-enable msgpack
# install APCu
RUN pecl install apcu && \
docker-php-ext-enable apcu --ini-name docker-php-ext-10-apcu.ini
RUN apt-get update -y && apt-get install -y apt-transport-https locales gnupg
# install MSSQL support and ODBC driver
# RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
# curl https://packages.microsoft.com/config/debian/8/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
# export DEBIAN_FRONTEND=noninteractive && apt-get update -y && \
# ACCEPT_EULA=Y apt-get install -y msodbcsql unixodbc-dev
# RUN set -xe \
# && pecl install pdo_sqlsrv \
# && docker-php-ext-enable pdo_sqlsrv \
# && apt-get purge -y unixodbc-dev && apt-get autoremove -y && apt-get clean
# RUN docker-php-ext-configure spl && docker-php-ext-install spl
# install GD
RUN docker-php-ext-configure gd \
--with-png-dir \
--with-jpeg-dir \
--with-xpm-dir \
--with-webp-dir \
--with-freetype-dir \
&& docker-php-ext-install -j$(nproc) gd
# set locale to utf-8
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
#--------------------------------------------------------------------------
# Final Touches
#--------------------------------------------------------------------------
# install required libs for health check
RUN apt-get -y install libfcgi0ldbl nano htop iotop lsof cron mariadb-client redis-tools wget
# install composer
RUN EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" && \
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then >&2 echo 'ERROR: Invalid installer checksum' && exit 1; fi
RUN php composer-setup.php --quiet && rm composer-setup.php && \
mv composer.phar /usr/local/sbin/composer && \
chmod +x /usr/local/sbin/composer
# install NewRelic agent
RUN echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list && \
curl https://download.newrelic.com/548C16BF.gpg | apt-key add - && \
apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install newrelic-php5 newrelic-sysmond && \
export NR_INSTALL_SILENT=1 && newrelic-install install
# install SendGrid
RUN echo "postfix postfix/mailname string localhost" | debconf-set-selections && \
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections && \
DEBIAN_FRONTEND=noninteractive apt-get install postfix libsasl2-modules -y
# Set default work directory
ADD scripts/* /usr/local/bin/
RUN chmod +x /usr/local/bin/*
# Add default configuration files
ADD configs/php.ini /usr/local/etc/php/
ADD configs/www.conf /usr/local/etc/php-fpm.d/
# Health check
RUN echo '#!/bin/bash' > /healthcheck && \
echo 'env -i SCRIPT_NAME=/health SCRIPT_FILENAME=/health REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000 || exit 1' >> /healthcheck && \
chmod +x /healthcheck
# Clean up
RUN apt-get remove -y git && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /