forked from egeloen/ivory-ordered-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
IDE_SERVER_NAME=ivory-ordered-form | ||
GROUP_ID=1000 | ||
USER_ID=1000 | ||
SYMFONY_DEPRECATIONS_HELPER=strict | ||
XDEBUG=0 | ||
XDEBUG_HOST=192.168.0.1 | ||
XDEBUG_PORT=9000 | ||
XDEBUG_IDEKEY=PHPSTORM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
/docker export-ignore | ||
/tests export-ignore | ||
/.env.dist export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.php_cs export-ignore | ||
.scrutinizer.yml export-ignore | ||
.travis.yml export-ignore | ||
CONTRIBUTING.md export-ignore | ||
docker-compose.yml export-ignore | ||
phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
/composer.lock | ||
/vendor | ||
|
||
# Docker | ||
/.env | ||
|
||
# PHP CS Fixer | ||
/.php_cs.cache | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,22 +33,13 @@ $ git clone [email protected]:your-name/ivory-ordered-form.git | |
$ git checkout -b bug-fix-description | ||
``` | ||
|
||
Then, install the dependencies through [Composer](https://getcomposer.org/): | ||
|
||
``` bash | ||
$ composer install | ||
``` | ||
Then, we recommend to use [Docker](https://www.docker.com) and follow this [instructions](/doc/docker.md) in order to | ||
set up the project. | ||
|
||
When you're on the new branch with the dependencies, code as much as you want and when the fix is ready, don't commit | ||
it immediately. Before, you will need to add tests and update the doc. For the tests, everything is tested with | ||
[PHPUnit](http://phpunit.de/) and the doc is in the markdown format under the `doc` directory. | ||
|
||
To run the tests, use the following command: | ||
|
||
``` bash | ||
$ vendor/bin/phpunit | ||
``` | ||
|
||
Then, when you have fixed the bug, tested it and documented it, you can commit and push it with the following commands: | ||
|
||
``` bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Docker | ||
|
||
The most easy way to set up the project is to install [Docker](https://www.docker.com) and | ||
[Docker Composer](https://docs.docker.com/compose/) and build the project. | ||
|
||
## Configure | ||
|
||
The configuration is shipped with a distribution environment file allowing you to customize your IDE and XDebug | ||
settings as well as your current user/group ID: | ||
|
||
``` bash | ||
$ cp .env.dist .env | ||
``` | ||
|
||
**The most important part is the `USER_ID` and `GROUP_ID` which should match your current user/group.** | ||
|
||
## Build | ||
|
||
Once you have configured your environment, you can build the project: | ||
|
||
``` bash | ||
$ docker-compose build | ||
``` | ||
|
||
## Composer | ||
|
||
Install the dependencies via [Composer](https://getcomposer.org/): | ||
|
||
``` bash | ||
$ docker-compose run --rm php composer install | ||
``` | ||
|
||
## Tests | ||
|
||
To run the test suite, you can use: | ||
|
||
``` bash | ||
$ docker-compose run --rm php vendor/bin/phpunit | ||
``` | ||
|
||
## XDebug | ||
|
||
If you want to use XDebug, make sure you have fully configured your `.env` file and use: | ||
|
||
``` bash | ||
$ docker-compose run --rm -e XDEBUG=1 php vendor/bin/phpunit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '2' | ||
|
||
services: | ||
php: | ||
build: docker | ||
environment: | ||
USER_ID: ${USER_ID} | ||
GROUP_ID: ${GROUP_ID} | ||
SYMFONY_DEPRECATIONS_HELPER: ${SYMFONY_DEPRECATIONS_HELPER} | ||
XDEBUG: ${XDEBUG} | ||
XDEBUG_CONFIG: remote_host=${XDEBUG_HOST} remote_port=${XDEBUG_PORT} idekey=${XDEBUG_IDEKEY} | ||
PHP_IDE_CONFIG: serverName=${IDE_SERVER_NAME} | ||
volumes: | ||
- ~/.composer:/var/www/.composer | ||
- .:/var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM php:latest | ||
|
||
# APT packages | ||
RUN apt-get update && apt-get install -y \ | ||
zlib1g-dev \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# PHP extensions | ||
RUN docker-php-ext-install zip | ||
|
||
# XDebug extensions | ||
RUN pecl install xdebug && rm -rf /tmp/pear | ||
COPY config/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini | ||
|
||
# Bash | ||
RUN chsh -s /bin/bash www-data | ||
|
||
# Composer | ||
RUN curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin | ||
|
||
# Workdir | ||
WORKDIR /var/www/html | ||
|
||
# Entrypoint | ||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" | ||
xdebug.cli_color=1 | ||
xdebug.remote_enable=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
GROUP_ID=${GROUP_ID-1000} | ||
USER_ID=${USER_ID-1000} | ||
XDEBUG=${XDEBUG-0} | ||
|
||
# Disable XDebug | ||
if [ ! ${XDEBUG} = 1 ]; then | ||
rm -f /usr/local/etc/php/conf.d/xdebug.ini | ||
fi | ||
|
||
# Permissions | ||
groupmod -g ${GROUP_ID} www-data | ||
usermod -u ${USER_ID} www-data | ||
|
||
# Start bash or forward command | ||
if [ $1 = "bash" ]; then | ||
su www-data | ||
else | ||
su www-data -c "$*" | ||
fi |