-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile-56
234 lines (187 loc) · 6.32 KB
/
Dockerfile-56
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
FROM phusion/baseimage:latest-amd64
MAINTAINER Maxime HELIAS <maximehelias16@gmail.com>
RUN DEBIAN_FRONTEND=noninteractive
RUN locale-gen en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV TERM xterm
#####################################
# Non-Root User:
#####################################
# Add a non-root user to prevent files being created with root permissions on host machine.
ARG PUID=1000
ARG PGID=1000
ENV PUID ${PUID}
ENV PGID ${PGID}
RUN groupadd -g ${PGID} dockermygis && \
useradd -u ${PUID} -g dockermygis -m dockermygis && \
apt-get update -yqq
#####################################
# Add content
COPY . /usr/local/docker
RUN chmod -R 777 /usr/local/docker
# Add the "PHP 5" ppa
RUN apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ondrej/php
#####################################
# Software's Installation
#####################################
# Install "PHP Extentions", "libraries", "Software's"
RUN apt-get update && \
apt-get install -y --allow-downgrades --allow-remove-essential \
--allow-change-held-packages \
php5.6-cli \
php5.6-common \
php5.6-curl \
php5.6-intl \
php5.6-json \
php5.6-xml \
php5.6-mbstring \
php5.6-mcrypt \
php5.6-mysql \
php5.6-pgsql \
php5.6-sqlite \
php5.6-sqlite3 \
php5.6-zip \
php5.6-bcmath \
php5.6-memcached \
php5.6-gd \
php5.6-dev \
pkg-config \
libcurl4-openssl-dev \
libedit-dev \
libssl-dev \
libxml2-dev \
xz-utils \
libsqlite3-dev \
sqlite3 \
git \
curl \
vim \
nano \
postgresql-client \
&& apt-get clean
#####################################
# Set Timezone
#####################################
ARG TZ=UTC
ENV TZ ${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#####################################
# Composer:
#####################################
# Install composer and add its bin to the PATH.
RUN curl -s http://getcomposer.org/installer | php && \
echo "export PATH=${PATH}:/var/www/vendor/bin" >> ~/.bashrc && \
mv composer.phar /usr/local/bin/composer
# Add the composer.json
COPY ./composer.json /home/dockermygis/.composer/composer.json
# Make sure that ~/.composer belongs to dockermygis
RUN chown -R dockermygis:dockermygis /home/dockermygis/.composer
USER dockermygis
# Check if global install need to be ran
ARG COMPOSER_GLOBAL_INSTALL=false
ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
# run the install
RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \
;fi
# Export composer vendor path
RUN echo "" >> ~/.bashrc && \
echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc
#####################################
# User Aliases
#####################################
USER dockermygis
COPY ./aliases.sh /home/dockermygis/aliases.sh
RUN echo "" >> ~/.bashrc && \
echo "# Load Custom Aliases" >> ~/.bashrc && \
echo "source /home/dockermygis/aliases.sh" >> ~/.bashrc && \
echo "" >> ~/.bashrc && \
sed -i 's/\r//' /home/dockermygis/aliases.sh && \
sed -i 's/^#! \/bin\/sh/#! \/bin\/bash/' /home/dockermygis/aliases.sh
USER root
RUN echo "" >> ~/.bashrc && \
echo "# Load Custom Aliases" >> ~/.bashrc && \
echo "source /home/dockermygis/aliases.sh" >> ~/.bashrc && \
echo "" >> ~/.bashrc && \
sed -i 's/\r//' /home/dockermygis/aliases.sh && \
sed -i 's/^#! \/bin\/sh/#! \/bin\/bash/' /home/dockermygis/aliases.sh
#####################################
# xDebug:
#####################################
ARG INSTALL_XDEBUG=false
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
# Load the xdebug extension only with phpunit commands
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
apt-get install -y --force-yes php5.6-xdebug && \
sed -i 's/^;//g' /etc/php/5.6/cli/conf.d/20-xdebug.ini && \
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \
;fi
# ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/5.6/cli/conf.d/xdebug.ini
#####################################
# Blackfire:
#####################################
ARG INSTALL_BLACKFIRE=false
ARG BLACKFIRE_CLIENT_ID
ARG BLACKFIRE_CLIENT_TOKEN
ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID}
ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN}
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
curl -L https://packagecloud.io/gpg.key | apt-key add - && \
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \
apt-get update -yqq && \
apt-get install blackfire-agent \
;fi
#####################################
# PHP REDIS EXTENSION FOR PHP 5.6
#####################################
ARG INSTALL_PHPREDIS=false
ENV INSTALL_PHPREDIS ${INSTALL_PHPREDIS}
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
pecl install redis && \
echo "extension=redis.so" >> /etc/php/5.6/mods-available/redis.ini && \
phpenmod redis \
;fi
#####################################
# AMQP:
#####################################
ARG INSTALL_AMQP=false
ENV INSTALL_AMQP ${INSTALL_AMQP}
RUN if [ ${INSTALL_AMQP} = true ]; then \
apt-get install librabbitmq-dev -y && \
pecl install amqp && \
echo "extension=amqp.so" >> /etc/php/5.6/mods-available/amqp.ini && \
ln -s /etc/php/5.6/mods-available/amqp.ini /etc/php/5.6/cli/conf.d/30-amqp.ini \
;fi
#####################################
# Image optimizers:
#####################################
USER root
ARG INSTALL_IMAGE_OPTIMIZERS=false
ENV INSTALL_IMAGE_OPTIMIZERS ${INSTALL_IMAGE_OPTIMIZERS}
RUN if [ ${INSTALL_IMAGE_OPTIMIZERS} = true ]; then \
apt-get install -y --force-yes jpegoptim optipng pngquant gifsicle \
;fi
USER dockermygis
#####################################
# ImageMagick:
#####################################
USER root
ARG INSTALL_IMAGEMAGICK=false
ENV INSTALL_IMAGEMAGICK ${INSTALL_IMAGEMAGICK}
RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
apt-get install -y --force-yes imagemagick php-imagick \
;fi
#####################################
# Final:
#####################################
# Clean up
USER root
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set default work directory
WORKDIR /var/www