@@ -32,13 +32,46 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
3232#
3333# Optional Software's will only be installed if you set them to `true`
3434# in the `docker-compose.yml` before the build.
35+ # Example:
36+ # - INSTALL_NODE=false
37+ # - ...
3538#
36- # - INSTALL_XDEBUG= false
37- # - INSTALL_MONGO= false
38- # - COMPOSER_GLOBAL_INSTALL= false
39- # - INSTALL_NODE= false
40- # - INSTALL_DRUSH= false
41- #
39+
40+ # ####################################
41+ # Non-Root User:
42+ # ####################################
43+
44+ # Add a non-root user to prevent files being created with root permissions on host machine.
45+ ARG PUID=1000
46+ ARG PGID=1000
47+ RUN groupadd -g $PGID laradock && \
48+ useradd -u $PUID -g laradock -m laradock
49+
50+ # ####################################
51+ # Composer:
52+ # ####################################
53+
54+ # Add the composer.json
55+ COPY ./composer.json /home/laradock/.composer/composer.json
56+
57+ # Make sure that ~/.composer belongs to laradock
58+ RUN chown -R laradock:laradock /home/laradock/.composer
59+ USER laradock
60+
61+ # Check if global install need to be ran
62+ ARG COMPOSER_GLOBAL_INSTALL=false
63+ ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
64+ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
65+ # run the install
66+ composer global install \
67+ ;fi
68+
69+ # ####################################
70+ # Crontab
71+ # ####################################
72+ USER root
73+
74+ COPY ./crontab /var/spool/cron/crontabs
4275
4376# ####################################
4477# xDebug:
@@ -57,17 +90,15 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
5790# ADD for REMOTE debugging
5891COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
5992
60-
6193# ####################################
6294# ssh:
6395# ####################################
96+ ARG INSTALL_WORKSPACE_SSH=false
97+ ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
6498
65- # Check if ssh needs to be installed
66- # See: https://github.com/phusion/baseimage-docker#enabling_ssh
6799ADD insecure_id_rsa /tmp/id_rsa
68100ADD insecure_id_rsa.pub /tmp/id_rsa.pub
69- ARG INSTALL_WORKSPACE_SSH=false
70- ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
101+
71102RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
72103 rm -f /etc/service/sshd/down && \
73104 cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
@@ -78,7 +109,6 @@ RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
78109 && chmod 400 /root/.ssh/id_rsa \
79110;fi
80111
81-
82112# ####################################
83113# MongoDB:
84114# ####################################
@@ -92,35 +122,6 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
92122 echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \
93123;fi
94124
95- # ####################################
96- # Non-Root User:
97- # ####################################
98-
99- # Add a non-root user to prevent files being created with root permissions on host machine.
100- ARG PUID=1000
101- ARG PGID=1000
102- RUN groupadd -g $PGID laradock && \
103- useradd -u $PUID -g laradock -m laradock
104-
105- # ####################################
106- # Composer:
107- # ####################################
108-
109- # Add the composer.json
110- COPY ./composer.json /home/laradock/.composer/composer.json
111-
112- # Make sure that ~/.composer belongs to laradock
113- RUN chown -R laradock:laradock /home/laradock/.composer
114- USER laradock
115-
116- # Check if global install need to be ran
117- ARG COMPOSER_GLOBAL_INSTALL=false
118- ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
119- RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
120- # run the install
121- composer global install \
122- ;fi
123-
124125# ####################################
125126# Drush:
126127# ####################################
@@ -167,6 +168,7 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
167168
168169# Add NVM binaries to root's .bashrc
169170USER root
171+
170172RUN if [ ${INSTALL_NODE} = true ]; then \
171173 echo "" >> ~/.bashrc && \
172174 echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \
@@ -177,10 +179,13 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
177179# PHP Aerospike:
178180# ####################################
179181USER root
180- ARG INSTALL_AEROSPIKE_EXTENSION=false
182+
183+ ARG INSTALL_AEROSPIKE_EXTENSION=true
181184ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
185+
182186# Copy aerospike configration for remote debugging
183187COPY ./aerospike.ini /etc/php/7.0/cli/conf.d/aerospike.ini
188+
184189RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
185190 # Install the php aerospike extension
186191 curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \
@@ -194,16 +199,11 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
194199 ) \
195200 && rm /tmp/aerospike-client-php.tar.gz \
196201;fi
202+
197203RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
198204 rm /etc/php/7.0/cli/conf.d/aerospike.ini \
199205;fi
200206
201- # ####################################
202- # Crontab
203- # ####################################
204- USER root
205- COPY ./crontab /var/spool/cron/crontabs
206-
207207#
208208# --------------------------------------------------------------------------
209209# Final Touch
0 commit comments