-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathDockerfile
194 lines (190 loc) · 6.24 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
FROM debian:buster
MAINTAINER keopx <keopx@keopx.net>
#
# Step 1: Installation
#
# System environments
ENV DEBIAN_FRONTEND="noninteractive" \
LOCALE="es_ES.UTF-8" \
GOTPL_VER="0.1.5" \
DEFAULT_ROOT="/var/www/html" \
UID="1000" \
GID="1000" \
UNAME="keopx"
# Set repositories
RUN \
echo "deb http://ftp.de.debian.org/debian/ buster main non-free contrib" > /etc/apt/sources.list && \
echo "deb-src http://ftp.de.debian.org/debian/ buster main non-free contrib" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \
apt-get -qq update && apt-get -qqy upgrade && \
# Install some basic tools needed for deployment
apt-get -yqq install \
apt-utils \
build-essential \
debconf-utils \
debconf \
default-mysql-client \
locales \
curl \
wget \
unzip \
patch \
rsync \
vim \
nano \
openssh-client \
git \
bash-completion \
locales \
libjpeg-turbo-progs libjpeg-progs \
pngcrush optipng && \
# Install locale
sed -i -e "s/# $LOCALE/$LOCALE/" /etc/locale.gen && \
echo "LANG=$LOCALE">/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=$LOCALE && \
# GOTPL
gotpl_url="/~https://github.com/wodby/gotpl/releases/download/${GOTPL_VER}/gotpl-linux-amd64-${GOTPL_VER}.tar.gz"; \
wget -qO- "${gotpl_url}" | tar xz -C /usr/local/bin; \
# Configure Sury sources
# @see https://www.noobunbox.net/serveur/auto-hebergement/installer-php-7-1-sous-debian-et-ubuntu
apt-get -yqq install apt-transport-https lsb-release ca-certificates && \
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
# Install PHP7 with Xdebug (dev environment)
apt-get -qq update && \
apt-get -yqq install \
php7.1 \
php7.1-bcmath \
php7.1-bz2 \
php7.1-curl \
php7.1-dev \
php7.1-gd \
php7.1-dom \
php7.1-imap \
php7.1-imagick \
php7.1-intl \
php7.1-json \
php7.1-ldap \
php7.1-mbstring \
php7.1-mcrypt \
php7.1-mysql \
php7.1-oauth \
php7.1-odbc \
php7.1-uploadprogress \
php7.1-ssh2 \
php7.1-xml \
php7.1-yaml \
php7.1-zip \
php7.1-solr \
php7.1-apcu \
php7.1-opcache \
php7.1-redis \
php7.1-memcache \
php7.1-memcached \
php7.1-xdebug \
libapache2-mod-php7.1 && \
# Install manually xhprof
cd /tmp && \
wget /~https://github.com/Yaoguais/phpng-xhprof/archive/master.zip && \
unzip master.zip && \
cd phpng-xhprof-master && \
phpize7.1 && \
./configure --with-php-config=/usr/bin/php-config7.1 && \
make && make install && \
mv /usr/lib/php/20160303/phpng_xhprof.so /usr/lib/php/20160303/xhprof.so && \
echo "extension=xhprof.so" > /etc/php/7.1/mods-available/xhprof.ini && \
echo "xhprof.output_dir=/var/www/xhprof" >> /etc/php/7.1/mods-available/xhprof.ini && \
# Install manually APC
echo "extension=apcu.so" > /etc/php/7.1/mods-available/apcu_bc.ini && \
echo "extension=apc.so" >> /etc/php/7.1/mods-available/apcu_bc.ini && \
# Install SMTP.
apt-get -yqq install libgnutls-openssl27 && \
wget ftp.de.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.64-8+b2_amd64.deb && \
dpkg -i ssmtp_2.64-8+b2_amd64.deb && rm ssmtp_2.64-8+b2_amd64.deb && \
# Install Apache web server.
apt-get -yqq install apache2 && \
#
# Step 2: Configuration
#
# Enable uploadprogress, imagick, redis and solr.
phpenmod uploadprogress imagick redis solr && \
# Disable by default apcu, apcu_bc, opcache, xdebug and xhprof. Use docker-compose.yml to add file.
phpdismod apcu apcu_bc opcache xdebug xhprof && \
# Remove all sites enabled
# RUN rm /etc/apache2/sites-enabled/*
# Configure needed apache modules and disable default site
# mpm_worker enabled.
a2dismod mpm_event cgi && \
a2enmod \
access_compat \
actions \
alias \
auth_basic \
authn_core \
authn_file \
authz_core \
authz_groupfile \
authz_host \
authz_user \
autoindex \
dir \
env \
expires \
filter \
headers \
mime \
negotiation \
php7.1 \
mpm_prefork \
reqtimeout \
rewrite \
setenvif \
status \
ssl && \
# without the following line we get "AH00558: apache2: Could not reliably determine the server's fully qualified domain name"
# autorise .htaccess files
sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf && \
# Install composer (latest version) | prestissimo to speed up composer
php -r "copy('https://getcomposer.org/composer-1.phar', 'composer.phar');" && \
php composer.phar && \
mv composer.phar /usr/local/bin/composer && \
chmod 755 /usr/local/bin/composer && \
composer global require "hirak/prestissimo:^0.3" && \
### Install DRUSH (latest stable) ###
# Run this in your terminal to get the latest DRUSH project version:
composer global require drush/drush && \
~/.composer/vendor/bin/drush init -y && \
curl -OL /~https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar && \
mv drush.phar /usr/local/bin/drush && \
chmod +x /usr/local/bin/drush && \
### Install DRUPAL CONSOLE (latest version) ###
# Run this in your terminal to get the latest project version:
# curl https://drupalconsole.com/installer -L -o drupal.phar && \
# mv drupal.phar /usr/local/bin/drupal && \
# chmod +x /usr/local/bin/drupal && \
# drupal self-update && \
# Bash setup.
echo ". /usr/share/bash-completion/bash_completion" >> ~/.bashrc && echo "alias ll='ls -lahs'" >> ~/.bashrc && \
#
# Step 3: Clean the system
#
# Cleanup some things.
apt-get -q autoclean && \
rm -rf /var/lib/apt/lists/* && \
#
# Step 4: Run
#
# Create 'keopx' user like local machime user.
groupadd -g $UID $GID ; \
useradd -m -u $UID -g $GID -s /bin/bash $UNAME ; \
usermod -aG www-data $UNAME; \
echo ". /usr/share/bash-completion/bash_completion" >> ~/.bashrc && echo "alias ll='ls -lahs'" >> /home/$UNAME/.bashrc
# Working dir
WORKDIR ${DEFAULT_ROOT}
# Configure templates
COPY templates /etc/gotpl/
COPY scripts/apache2-foreground /usr/bin/
EXPOSE 80 443
CMD ["apache2-foreground"]