diff --git a/README.md b/README.md index e4e9355..4a66adc 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) + - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) @@ -608,7 +609,7 @@ It should be like this: ... ``` -2 - Re-build the containers docker-compose build workspace php-fpm +2 - Re-build the containers `docker-compose build workspace php-fpm` @@ -800,9 +801,7 @@ It should be like this: ... ``` -2 - Re-build the containers docker-compose build workspace php-fpm - -3 - Use it +2 - Re-build the containers `docker-compose build workspace php-fpm` @@ -906,17 +905,16 @@ server_name laravel.dev; ``` +
- -### Install Prestissimo + +### Enable Global Composer Build Install -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. +To enable Running Global Composer Install during the Build: -To install Prestissimo in the Workspace container +1 - open the `docker-compose.yml` file -1 - Open the `docker-compose.yml` file - -2 - Search for the `INSTALL_PRESTISSIMO` argument under the Workspace Container and set it to `true` +2 - search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true` It should be like this: @@ -925,11 +923,37 @@ It should be like this: build: context: ./workspace args: - - INSTALL_PRESTISSIMO=true + - COMPOSER_GLOBAL_INSTALL=true ... ``` +3 - now add your dependencies to `workspace/composer.json` + +4 - rebuild the Workspace Container `docker-compose build workspace` + + + + +
+ +### Install Prestissimo + +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. + +1 - Enable Running Global Composer Install during the Build: + +Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) and do steps 1 and 2 only then continue here. + +2 - Add prestissimo as requirement in Composer: + +a - now open the `workspace/composer.json` file + +b - add `"hirak/prestissimo": "^0.3"` as requirement + +c - rebuild the Workspace Container `docker-compose build workspace` + + + -3 - Re-build the container docker-compose build workspace ### Install Node + NVM @@ -951,7 +975,7 @@ It should be like this: ... ``` -3 - Re-build the container docker-compose build workspace +3 - Re-build the container `docker-compose build workspace`
diff --git a/docker-compose.yml b/docker-compose.yml index 37b417f..ab3dc0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - INSTALL_MONGO=false - INSTALL_XDEBUG=false - INSTALL_NODE=false - - INSTALL_PRESTISSIMO=false + - COMPOSER_GLOBAL_INSTALL=false volumes_from: - volumes_source tty: true diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 62ba840..c9af47d 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -59,44 +59,71 @@ RUN apt-get update && \ nano \ && apt-get clean -# Composer: Install composer and add its bin to the PATH. +##################################### +# Composer: +##################################### + +# Install composer and add its bin to the PATH. RUN curl -s http://getcomposer.org/installer | php && \ echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \ mv composer.phar /usr/local/bin/composer -ARG INSTALL_PRESTISSIMO=true -ENV INSTALL_PRESTISSIMO ${INSTALL_PRESTISSIMO} +# Add the composer.json +ADD ./composer.json /root/.composer/composer.json + +# Check if global install need to be runned +ARG COMPOSER_GLOBAL_INSTALL=true +ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} RUN if [ ${INSTALL_PRESTISSIMO} = true ]; then \ - # Prestissimo: Install Prestissimo (A Composer parallel install plugin) - composer global require "hirak/prestissimo:^0.3" \ + # run the install + composer global install \ ;fi + +##################################### +# MongoDB: +##################################### + +# Check if Mongo needs to be installed ARG INSTALL_MONGO=true ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ - # MongoDB: Install the mongodb extension + # Install the mongodb extension pecl install mongodb && \ - echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ + echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ ;fi +##################################### +# xDebug: +##################################### + +# Check if xDebug needs to be installed ARG INSTALL_XDEBUG=true ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ - # XDebug: Load the xdebug extension only with phpunit commands + # Load the xdebug extension only with phpunit commands apt-get install -y --force-yes php7.0-xdebug && \ - sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ - echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ + sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ + echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ ;fi +##################################### +# Node / NVM: +##################################### + +# Check if NVM needs to be installed ARG INSTALL_NODE=true ENV INSTALL_NODE ${INSTALL_NODE} RUN if [ ${INSTALL_NODE} = true ]; then \ - # Node: Install nvm (A Node Version Manager) and use it to install NodeJS + # Install nvm (A Node Version Manager) curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \ ;fi +# Again check if NVM needs to be installed +# I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! ENV if [ ${INSTALL_NODE} = true ]; then \ - # I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! + # Set the ENV NVM_DIR=/root/.nvm \ + # Install NodeJS with NVM RUN . ~/.nvm/nvm.sh && \ nvm install stable && \ nvm use stable && \ diff --git a/workspace/composer.json b/workspace/composer.json new file mode 100644 index 0000000..0c1370f --- /dev/null +++ b/workspace/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + + } +}