Skip to content

Commit 2a02ed7

Browse files
committed
Refactor the workspace container
1 parent ca378ac commit 2a02ed7

1 file changed

Lines changed: 36 additions & 22 deletions

File tree

workspace/Dockerfile

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
#--------------------------------------------------------------------------
3+
# Image Setup
4+
#--------------------------------------------------------------------------
5+
#
6+
17
FROM phusion/baseimage:latest
28

39
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
@@ -11,6 +17,12 @@ ENV LC_CTYPE=UTF-8
1117
ENV LANG=en_US.UTF-8
1218
ENV TERM xterm
1319

20+
#
21+
#--------------------------------------------------------------------------
22+
# Software's Installation
23+
#--------------------------------------------------------------------------
24+
#
25+
1426
# Install "software-properties-common" (for the "add-apt-repository")
1527
RUN apt-get update && apt-get install -y \
1628
software-properties-common
@@ -19,7 +31,7 @@ RUN apt-get update && apt-get install -y \
1931
RUN add-apt-repository -y \
2032
ppa:ondrej/php
2133

22-
# Install PHP-CLI 7, some PHP extentions and some useful Tools with APT
34+
# Install "PHP-CLI 7", "PHP extentions", "useful Tools"
2335
RUN apt-get update && apt-get install -y --force-yes \
2436
php7.0-cli \
2537
php7.0-common \
@@ -50,38 +62,45 @@ RUN apt-get update && apt-get install -y --force-yes \
5062
nano \
5163
pkg-config
5264

53-
# Clean up, to free some space
65+
# Clean up now, to free up some space
5466
RUN apt-get clean
5567

56-
# remove load xdebug extension (only load on phpunit command)
57-
RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini
58-
59-
# Add bin folder of composer to PATH.
60-
RUN echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc
61-
62-
# Install Composer
68+
# Composer: Install composer and add its bin to the PATH.
6369
RUN curl -s http://getcomposer.org/installer | php \
70+
&& echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc \
6471
&& mv composer.phar /usr/local/bin/composer
6572

66-
# Load xdebug Zend extension with phpunit command
67-
RUN echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc
73+
# Prestissimo: Install Prestissimo (A Composer parallel install plugin)
74+
ARG INSTALL_PRESTISSIMO=false
75+
RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \
76+
composer global require "hirak/prestissimo:^0.3"; \
77+
fi
6878

69-
# Install mongodb extension
70-
RUN pecl install mongodb
71-
RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini
79+
# MongoDB: Install the mongodb extension
80+
RUN pecl install mongodb \
81+
&& echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini
7282

73-
# Install nvm (Node Version Manager)
74-
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
83+
# XDebug: Load the xdebug extension only with phpunit commands
84+
RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini \
85+
&& echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc
7586

87+
# NVM: Install nvm (A Node Version Manager)
88+
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
7689
ENV NVM_DIR=/root/.nvm
7790

78-
# Install stable node
91+
# Node: Install node
7992
RUN . ~/.nvm/nvm.sh \
8093
&& nvm install stable \
8194
&& nvm use stable \
8295
&& nvm alias stable \
8396
&& npm install -g gulp bower
8497

98+
#
99+
#--------------------------------------------------------------------------
100+
# Final Touch
101+
#--------------------------------------------------------------------------
102+
#
103+
85104
# Source the bash
86105
RUN . ~/.bashrc
87106

@@ -90,8 +109,3 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
90109

91110
WORKDIR /var/www/laravel
92111

93-
# Install optional software
94-
ARG INSTALL_PRESTISSIMO=false
95-
RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \
96-
composer global require "hirak/prestissimo:^0.3"; \
97-
fi

0 commit comments

Comments
 (0)