Skip to content

Instantly share code, notes, and snippets.

@kyl0b1te
Created April 6, 2018 15:54
Show Gist options
  • Save kyl0b1te/414e32c919ef4961908cede319d6bb05 to your computer and use it in GitHub Desktop.
Save kyl0b1te/414e32c919ef4961908cede319d6bb05 to your computer and use it in GitHub Desktop.
Docker laravel project builder

Gist for build new laravel project skeleton

Build the dockerfile by command: docker build -t laravel-builder

For create a new project in your projects folder run:

docker run -it --rm -v "$PWD":/app php-builder laravel new [PHP PROJECT NAME]

It will create a new folder with project name and put all laravel files in it.

Additional dependencies can be also installed by:

docker run -it --rm -v "$PWD":/app php-builder composer require [COMPOSER DEPENDENCY NAME]

FROM php:7.1-cli
ENV COMPOSER_VERSION=1.6.3
# Update and install required packages
RUN apt-get update && apt-get install -y zlib1g-dev \
&& docker-php-ext-install zip
# Install composer
RUN curl https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar --output composer.phar \
&& chmod +x composer.phar \
&& mv composer.phar /usr/local/bin/composer
# Add a `builder` user
RUN useradd -ms /bin/bash builder
USER builder
# Install builders
RUN composer global require "laravel/installer"
ENV PATH="/home/builder/.composer/vendor/bin:${PATH}"
WORKDIR /app
CMD ["php", "-a"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment