-
Notifications
You must be signed in to change notification settings - Fork 102
/
Dockerfile
120 lines (101 loc) · 4.69 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
FROM php:7.0.16-fpm
MAINTAINER "Magento"
ENV PHP_EXTRA_CONFIGURE_ARGS="--enable-fpm --with-fpm-user=magento2 --with-fpm-group=magento2"
RUN apt-get update && apt-get install -y \
apt-utils \
sudo \
wget \
unzip \
cron \
curl \
libmcrypt-dev \
libicu-dev \
libxml2-dev libxslt1-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev \
git \
vim \
openssh-server \
supervisor \
mysql-client \
ocaml \
expect \
&& curl -L https://github.com/bcpierce00/unison/archive/2.48.4.tar.gz | tar zxv -C /tmp && \
cd /tmp/unison-2.48.4 && \
sed -i -e 's/GLIBC_SUPPORT_INOTIFY 0/GLIBC_SUPPORT_INOTIFY 1/' src/fsmonitor/linux/inotify_stubs.c && \
make && \
cp src/unison src/unison-fsmonitor /usr/local/bin && \
cd /root && rm -rf /tmp/unison-2.48.4 \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-configure hash --with-mhash \
&& docker-php-ext-install -j$(nproc) mcrypt intl xsl gd zip pdo_mysql opcache soap bcmath json iconv \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& pecl install xdebug && docker-php-ext-enable xdebug \
&& echo "xdebug.remote_enable=1" >> /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.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host=127.0.0.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.max_nesting_level=1000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& chmod 666 /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& mkdir /var/run/sshd \
&& apt-get clean && apt-get update && apt-get install -y nodejs \
&& ln -s /usr/bin/nodejs /usr/bin/node \
&& apt-get install -y npm \
&& npm update -g npm && npm install -g grunt-cli && npm install -g gulp \
&& echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
&& apt-get install -y apache2 \
&& a2enmod rewrite \
&& a2enmod proxy \
&& a2enmod proxy_fcgi \
&& rm -f /etc/apache2/sites-enabled/000-default.conf \
&& useradd -m -d /home/magento2 -s /bin/bash magento2 && adduser magento2 sudo \
&& echo "magento2 ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& touch /etc/sudoers.d/privacy \
&& echo "Defaults lecture = never" >> /etc/sudoers.d/privacy \
&& mkdir /home/magento2/magento2 && mkdir /var/www/magento2 \
&& mkdir /home/magento2/state \
&& curl -sS https://accounts.magento.cloud/cli/installer -o /home/magento2/installer \
&& rm -r /usr/local/etc/php-fpm.d/* \
&& sed -i 's/www-data/magento2/g' /etc/apache2/envvars
# PHP config
ADD conf/php.ini /usr/local/etc/php
# SSH config
COPY conf/sshd_config /etc/ssh/sshd_config
RUN chown magento2:magento2 /etc/ssh/ssh_config
# supervisord config
ADD conf/supervisord.conf /etc/supervisord.conf
# php-fpm config
ADD conf/php-fpm-magento2.conf /usr/local/etc/php-fpm.d/php-fpm-magento2.conf
# apache config
ADD conf/apache-default.conf /etc/apache2/sites-enabled/apache-default.conf
# unison script
ADD conf/.unison/magento2.prf /home/magento2/.unison/magento2.prf
ADD conf/unison.sh /usr/local/bin/unison.sh
ADD conf/entrypoint.sh /usr/local/bin/entrypoint.sh
ADD conf/check-unison.sh /usr/local/bin/check-unison.sh
RUN chmod +x /usr/local/bin/unison.sh && chmod +x /usr/local/bin/entrypoint.sh \
&& chmod +x /usr/local/bin/check-unison.sh
ENV PATH $PATH:/home/magento2/scripts/:/home/magento2/.magento-cloud/bin
ENV PATH $PATH:/var/www/magento2/bin
ENV USE_SHARED_WEBROOT 1
ENV SHARED_CODE_PATH /var/www/magento2
ENV WEBROOT_PATH /var/www/magento2
ENV MAGENTO_ENABLE_SYNC_MARKER 0
# Initial scripts
COPY scripts/ /home/magento2/scripts/
RUN chmod +x /home/magento2/scripts/gitclone.sh \
&& chmod +x /home/magento2/scripts/install.sh
RUN sed -i 's/^/;/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& cd /home/magento2/scripts && composer install && chmod +x /home/magento2/scripts/m2init \
&& sed -i 's/^;;*//' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN chown -R magento2:magento2 /home/magento2 && \
chown -R magento2:magento2 /var/www && \
chmod 755 /home/magento2/scripts/bin/magento-cloud-login
# Delete user password to connect with ssh with empty password
RUN passwd magento2 -d
EXPOSE 80 22 5000 44100
WORKDIR /home/magento2
USER root
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]