From b0b504e3eff489b18caf143fcdef2b4402f986f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1ndara?= Date: Thu, 9 Aug 2018 20:11:43 +0200 Subject: [PATCH 1/3] Add Dockerfile to use the project without local PHP installation --- docker/php.dockerfile | 18 ++++++++++++++++++ up.sh | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 docker/php.dockerfile create mode 100755 up.sh diff --git a/docker/php.dockerfile b/docker/php.dockerfile new file mode 100644 index 0000000..1f66557 --- /dev/null +++ b/docker/php.dockerfile @@ -0,0 +1,18 @@ +FROM php:7.2.8-alpine3.7 + +RUN curl -sS https://getcomposer.org/installer | php \ + && mv composer.phar /usr/local/bin/ \ + && ln -s /usr/local/bin/composer.phar /usr/local/bin/composer + +RUN apk add --no-cache $PHPIZE_DEPS \ + && pecl install xdebug-2.6.0 \ + && docker-php-ext-enable xdebug + +RUN adduser -D -u 1000 codelytv + +RUN mkdir app \ + && chown codelytv app + +WORKDIR app + +USER codelytv diff --git a/up.sh b/up.sh new file mode 100755 index 0000000..019f750 --- /dev/null +++ b/up.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +IMAGE_NAME="codelytv-bootstrap" + +if [[ "$(docker images -q ${IMAGE_NAME}:latest 2> /dev/null)" == "" ]]; then + docker build -t ${IMAGE_NAME} -f docker/php.dockerfile ./docker +fi + +if [[ ! -a vendor ]]; then + docker run -v $(pwd):/app -t --rm ${IMAGE_NAME} sh -c "composer install" +fi + +docker run -it --rm -v $(pwd):/app ${IMAGE_NAME} sh From 7c63615de4823f6993dc94f58b71ccd2e8c5d14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1ndara?= Date: Thu, 9 Aug 2018 20:29:07 +0200 Subject: [PATCH 2/3] Update README.md to include Docker instructions --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 26da304..e177ea8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ It could be useful if you want to start from scratch a kata or a little exercise ## How To Start -You have 2 different alternatives: Using our [Packagist project](https://packagist.org/packages/codelytv/php-bootstrap) with Composer, or manually cloning [this repo](https://github.com/CodelyTV/php-bootstrap/): +You have 3 different alternatives: Using our [Packagist project](https://packagist.org/packages/codelytv/php-bootstrap) with Composer, manually cloning [this repo](https://github.com/CodelyTV/php-bootstrap/) +or using Docker: ### Using Composer @@ -67,6 +68,25 @@ Just in case you prefer to avoid dealing with `composer create-project`, you can 6. Upload your local commits to the new remote repo: `git push -u origin master` 7. Start coding! +### Using Docker + +You can avoid the need of a local PHP installation using Docker. + +1. You will need [Docker installed](https://docs.docker.com/install/) in your computer. +2. [Download](https://github.com/CodelyTV/php-bootstrap/archive/master.zip) this repository and unzip it in your project directory. +3. Run the script `up.sh` available in the project's root folder. The first time it will build the Docker image and download the dependencies, and you will end up in a container sharing the project folder with your local machine. +4. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands: + 1. [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint): `composer lint`. + 2. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`. + 3. [PHP Unit](https://phpunit.de/): `composer phpunit`. +5. Create your own repository: + 1. Initialize your own Git repository: `git init` + 2. Add the bootstrap files: `git add .` + 3. Commit: `git commit -m "Initial commit with project boilerplate based on https://github.com/CodelyTV/php-bootstrap"` + 4. Add your remote repository: `git remote add origin git@github.com:your-username/your-project-name` + 5. Upload your local commits to the new remote repo: `git push -u origin master` +6. Start coding! + ## Helpful resources ### PHP 7 From 6349370c5f9c372b1f7411c2a937d42ac1015067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1ndara?= Date: Thu, 9 Aug 2018 20:29:55 +0200 Subject: [PATCH 3/3] Update semver --- .semver | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.semver b/.semver index 55185f3..d9b50f2 100644 --- a/.semver +++ b/.semver @@ -1,5 +1,5 @@ --- :major: 1 -:minor: 2 -:patch: 1 +:minor: 3 +:patch: 0 :special: ''