-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker image and dockerized dev tools (#10)
* Add Makefile with dockerized dev tools * Add Makefile with dockerized dev tools * change composer installation: use latest version * Up php version for base docker image * Add to readme info about development installation with(-out) docker * Review fixes: - quotes around phpunit args - use php 7.1 for image - remove unused volumes mounting for composer - clean apt-get lists Reorder RUN instuctions for best layers caching, remove unused packages. * Fix PATH addition * Fix dockerized tools * readme cs fixes * Fix dockerfile lints * Fix lint: quote paths * Disable some dockerfile lint rules * bash quotes Co-authored-by: n.gnato <[email protected]>
- Loading branch information
Showing
9 changed files
with
92 additions
and
3 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,5 @@ | ||
ignored: | ||
- DL3003 | ||
- DL3008 | ||
- DL3059 | ||
- DL4006 |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/.idea/ | ||
/.phpunit.result.cache | ||
/_coverage/ | ||
/composer.lock | ||
/phpunit.xml | ||
/vendor/ |
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,19 @@ | ||
FROM php:7.1 | ||
|
||
# Enable phpdebug | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends libxml2-dev \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-source extract \ | ||
&& cd /usr/src/php \ | ||
&& ./configure --enable-phpdbg \ | ||
&& docker-php-source delete | ||
|
||
# Install composer and required packages | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
WORKDIR /app |
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,14 @@ | ||
## Add dockerized commands to path | ||
PATH := $(PATH):tools | ||
|
||
docker-build: | ||
docker build -t timeweb/phpstan-enum . | ||
|
||
install: | ||
composer install | ||
|
||
test: | ||
php vendor/bin/phpunit | ||
|
||
test-coverage: | ||
phpdbg -qrr vendor/bin/phpunit -d memory_limit=512m --coverage-html=_coverage --coverage-text |
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 |
---|---|---|
|
@@ -22,3 +22,24 @@ And include extension.neon in your project's PHPStan config | |
includes: | ||
- vendor/timeweb/phpstan-enum/extension.neon | ||
``` | ||
## Install for Local Development | ||
### With docker | ||
```bash | ||
git clone [email protected]:timeweb/phpstan-enum.git | ||
cd phpstan-enum | ||
make docker-build | ||
make install | ||
make phpunit | ||
``` | ||
|
||
### Without docker (localy installed actual version of php, composer, etc) | ||
|
||
```bash | ||
git clone [email protected]:timeweb/phpstan-enum.git | ||
cd phpstan-enum | ||
make install | ||
make 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,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p "$HOME/.composer/cache/" | ||
|
||
test -t 1 && USE_TTY="--tty" | ||
|
||
docker run --rm --interactive ${USE_TTY} \ | ||
--user $UID:$UID \ | ||
--volume "$PWD":/app \ | ||
--volume "$HOME/.composer":/tmp/.composer \ | ||
--env COMPOSER_HOME=/tmp/.composer \ | ||
timeweb/phpstan-enum composer "$@" |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
test -t 1 && USE_TTY="--tty" | ||
|
||
docker run --rm --init --interactive ${USE_TTY} \ | ||
--user $UID:$UID \ | ||
--volume "$PWD:/app" \ | ||
timeweb/phpstan-enum php "$@" |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
test -t 1 && USE_TTY="--tty" | ||
|
||
docker run --rm --init --interactive ${USE_TTY} \ | ||
--user $UID:$UID \ | ||
--volume "$PWD:/app" \ | ||
timeweb/phpstan-enum phpdbg "$@" |