This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
136 lines (113 loc) · 4.67 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
FROM php:7.0.12-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 \
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 \
&& 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=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 \
&& 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 \
&& mkdir /home/magento2/magento2 && mkdir /var/www/magento2 \
&& 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
RUN chown -R magento2:magento2 /home/magento2 && \
chown -R magento2:magento2 /var/www/magento2
ADD conf/unison.sh /usr/local/bin/unison.sh
ADD conf/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/unison.sh && chmod +x /usr/local/bin/entrypoint.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 USE_RABBITMQ 0
#ENV USE_REDIS_FULL_PAGE_CACHE 0
#ENV USE_REDIS_CACHE 0
#ENV USE_REDIS_SESSIONS 0
#ENV USE_VARNISH 0
#ENV USE_ELASTICSEARCH 0
#ENV MAGENTO_PUBLIC_KEY=""
#ENV MAGENTO_PRIVATE_KEY=""
#ENV MAGENTO_USE_SOURCES_IN_HOST 0
#ENV CREATE_SYMLINK_EE 0
#ENV HOST_CE_PATH=""
#ENV EE_DIRNAME=""
#ENV MAGENTO_DOWNLOAD_SOURCES_COMPOSER 1
#ENV MAGENTO_EDITION="CE"
#ENV MAGENTO_VERSION="2.1.2"
#ENV MAGENTO_SAMPLE_DATA_INSTALL 0
#ENV MAGENTO_DOWNLOAD_SOURCES_CLOUD 0
#ENV MAGENTO_CLOUD_USERNAME=""
#ENV MAGENTO_CLOUD_PASSWORD=""
#ENV MAGENTO_CLOUD_GENERATE_NEW_TOKEN 0
#ENV MAGENTO_CLOUD_PROJECT=""
#ENV MAGENTO_CLOUD_BRANCH=""
#ENV MAGENTO_CRON_RUN 1
#ENV MAGENTO_DI_COMPILE 0
#ENV MAGENTO_GRUNT_COMPILE 0
#ENV MAGENTO_STATIC_CONTENTS_DEPLOY 0
#ENV MAGENTO_BACKEND_PATH="admin"
#ENV MAGENTO_ADMIN_USER="admin"
#ENV MAGENTO_ADMIN_PASSWORD="admin123"
# Initial scripts
COPY scripts/ /home/magento2/scripts/
RUN cd /home/magento2/scripts && composer install && chmod +x /home/magento2/scripts/m2init
# Delete user password to connect with ssh with empty password
RUN passwd magento2 -d
EXPOSE 80 22 44100
WORKDIR /home/magento2
USER root
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]