add composer.json to install global composer dependencies
This commit is contained in:
parent
e1dbb972f1
commit
062b7466f6
52
README.md
52
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)
|
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
|
||||||
- [Find your Docker IP Address](#Find-Docker-IP-Address)
|
- [Find your Docker IP Address](#Find-Docker-IP-Address)
|
||||||
- [Use custom Domain](#Use-custom-Domain)
|
- [Use custom Domain](#Use-custom-Domain)
|
||||||
|
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
|
||||||
- [Install Prestissimo](#Install-Prestissimo)
|
- [Install Prestissimo](#Install-Prestissimo)
|
||||||
- [Install Node + NVM](#Install-Node)
|
- [Install Node + NVM](#Install-Node)
|
||||||
- [Debugging](#debugging)
|
- [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
|
2 - Re-build the containers `docker-compose build workspace php-fpm`
|
||||||
|
|
||||||
3 - Use it
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -906,17 +905,16 @@ server_name laravel.dev;
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Install-Prestissimo"></a>
|
<a name="Enable-Global-Composer-Build-Install"></a>
|
||||||
### 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 `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true`
|
||||||
|
|
||||||
2 - Search for the `INSTALL_PRESTISSIMO` argument under the Workspace Container and set it to `true`
|
|
||||||
|
|
||||||
It should be like this:
|
It should be like this:
|
||||||
|
|
||||||
@ -925,11 +923,37 @@ It should be like this:
|
|||||||
build:
|
build:
|
||||||
context: ./workspace
|
context: ./workspace
|
||||||
args:
|
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`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Install-Prestissimo"></a>
|
||||||
|
### 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
|
|
||||||
|
|
||||||
<a name="Install-Node"></a>
|
<a name="Install-Node"></a>
|
||||||
### Install Node + NVM
|
### 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`
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="debugging"></a>
|
<a name="debugging"></a>
|
||||||
|
@ -11,7 +11,7 @@ services:
|
|||||||
- INSTALL_MONGO=false
|
- INSTALL_MONGO=false
|
||||||
- INSTALL_XDEBUG=false
|
- INSTALL_XDEBUG=false
|
||||||
- INSTALL_NODE=false
|
- INSTALL_NODE=false
|
||||||
- INSTALL_PRESTISSIMO=false
|
- COMPOSER_GLOBAL_INSTALL=false
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- volumes_source
|
- volumes_source
|
||||||
tty: true
|
tty: true
|
||||||
|
@ -59,44 +59,71 @@ RUN apt-get update && \
|
|||||||
nano \
|
nano \
|
||||||
&& apt-get clean
|
&& 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 && \
|
RUN curl -s http://getcomposer.org/installer | php && \
|
||||||
echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \
|
echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \
|
||||||
mv composer.phar /usr/local/bin/composer
|
mv composer.phar /usr/local/bin/composer
|
||||||
|
|
||||||
ARG INSTALL_PRESTISSIMO=true
|
# Add the composer.json
|
||||||
ENV INSTALL_PRESTISSIMO ${INSTALL_PRESTISSIMO}
|
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 \
|
RUN if [ ${INSTALL_PRESTISSIMO} = true ]; then \
|
||||||
# Prestissimo: Install Prestissimo (A Composer parallel install plugin)
|
# run the install
|
||||||
composer global require "hirak/prestissimo:^0.3" \
|
composer global install \
|
||||||
;fi
|
;fi
|
||||||
|
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# MongoDB:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Check if Mongo needs to be installed
|
||||||
ARG INSTALL_MONGO=true
|
ARG INSTALL_MONGO=true
|
||||||
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||||
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||||
# MongoDB: Install the mongodb extension
|
# Install the mongodb extension
|
||||||
pecl install mongodb && \
|
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
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# xDebug:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Check if xDebug needs to be installed
|
||||||
ARG INSTALL_XDEBUG=true
|
ARG INSTALL_XDEBUG=true
|
||||||
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
|
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
|
||||||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
|
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 && \
|
apt-get install -y --force-yes php7.0-xdebug && \
|
||||||
sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \
|
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 \
|
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \
|
||||||
;fi
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Node / NVM:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Check if NVM needs to be installed
|
||||||
ARG INSTALL_NODE=true
|
ARG INSTALL_NODE=true
|
||||||
ENV INSTALL_NODE ${INSTALL_NODE}
|
ENV INSTALL_NODE ${INSTALL_NODE}
|
||||||
RUN if [ ${INSTALL_NODE} = true ]; then \
|
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 \
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \
|
||||||
;fi
|
;fi
|
||||||
ENV if [ ${INSTALL_NODE} = true ]; then \
|
# 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!
|
# 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 \
|
||||||
|
# Set the ENV
|
||||||
NVM_DIR=/root/.nvm \
|
NVM_DIR=/root/.nvm \
|
||||||
|
# Install NodeJS with NVM
|
||||||
RUN . ~/.nvm/nvm.sh && \
|
RUN . ~/.nvm/nvm.sh && \
|
||||||
nvm install stable && \
|
nvm install stable && \
|
||||||
nvm use stable && \
|
nvm use stable && \
|
||||||
|
5
workspace/composer.json
Normal file
5
workspace/composer.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"require": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user