-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
executable file
·119 lines (95 loc) · 5.04 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
FROM php:7.4-fpm
MAINTAINER Maciej Slawik <maciekslawik@gmail.com>
RUN apt-get update && apt-get install -y \
unzip wget
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer --version
# Set timezone
RUN rm /etc/localtime \
&& ln -s /usr/share/zoneinfo/Europe/Warsaw /etc/localtime \
&& "date"
# Install PDO
RUN apt-get install -y libpq-dev \
&& docker-php-ext-install pdo pdo_mysql pdo_pgsql
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
vim \
&& docker-php-ext-install -j$(nproc) iconv bcmath \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN apt-get install -y zlib1g-dev libicu-dev g++ libzip-dev git && \
docker-php-ext-configure intl && \
docker-php-ext-install intl zip sockets && \
apt-get purge -y g++
RUN apt-get install -y libxslt-dev
RUN docker-php-ext-install xsl soap mysqli
# Install xdebug
RUN pecl install xdebug-2.9.1 \
&& docker-php-ext-enable xdebug \
&& echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.profiler_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.profiler_output_dir=/tmp/snapshots" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.max_nesting_level=9999" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.profiler_enable_trigger=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Install Redis extension
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& echo "extension=redis.so" > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
# Install MongoDB extension
RUN pecl install mongodb \
&& rm -rf /tmp/pear \
&& echo "extension=mongodb.so" >> /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
# Set ID
RUN usermod -u 1000 www-data
# Add aliases for xdebug control
RUN echo 'alias xoff="mv /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini.off && kill -USR2 1"' >> ~/.bashrc
RUN echo 'alias xon="mv /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini.off /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && kill -USR2 1"' >> ~/.bashrc
# Change memory limit
RUN echo 'memory_limit = 2G ' >> /usr/local/etc/php/php.ini
# Install Blackfire probe - no version for 7.4 available yet
#RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
# && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
# && mkdir -p /tmp/blackfire \
# && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
# && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
# && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/docker-php-ext-blackfire.ini \
# && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
# Install Blackfire CLI executable
RUN mkdir -p /tmp/blackfire \
&& curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire /usr/bin/blackfire \
&& rm -Rf /tmp/blackfire
# Install newer libsodium
RUN wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz \
&& tar xfvz libsodium-1.0.18.tar.gz \
&& cd libsodium-1.0.18 \
&& ./configure \
&& make && make install \
&& pecl install -f libsodium
RUN docker-php-ext-install sodium
# Add aliases for www-data user
RUN touch /var/www/.bashrc && chown www-data /var/www/.bashrc
# Create cache dir for composer
RUN mkdir /var/www/.composer && chown www-data /var/www/.composer
#Install mailhog
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64
RUN chmod +x mhsendmail_linux_amd64
RUN mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
RUN echo "sendmail_path = \"/usr/local/bin/mhsendmail --smtp-addr='mailhog:1025'\"" >> /usr/local/etc/php/conf.d/docker-php-ext-mailhog.ini
# Frontend tools
RUN apt-get install -y curl gpgv
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
RUN apt-get install -y nodejs
RUN mv /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini.off
RUN chown -R www-data:www-data /var/www
RUN npm install -g grunt-cli
USER www-data