Skip to content

Commit

Permalink
Add Docker support for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Apr 15, 2022
1 parent 5bf400f commit c645e01
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/ICanBoogie/Inflector).

## Pull Requests

- **Add tests!** — Your contribution won't be accepted if it doesn't have tests.
- **Document any change in behaviour** — Make sure the `README.md` and any other relevant documentation are kept
up-to-date.
- **Consider our release cycle** — We follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not
an option.
- **Create feature branches** — We won't pull from your main branch.
- **One pull request per feature** — If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** — Make sure each individual commit in your pull request is meaningful. If you had to make
multiple intermediate commits while developing, please [squash them][git-squash] before submitting.

## Running Tests

We provide a Docker container for local development. Run `make test-container` to create a new session. Inside the
container run `make test` to run the test suite. Alternatively, run `make test-coverage` for a breakdown of the code
coverage. The coverage report is available in `build/coverage/index.html`.

**Thanks for your contribution**!


[git-squash]: http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-cli-alpine

RUN apk add --no-cache make && \
docker-php-ext-enable opcache && \
docker-php-source delete

RUN echo $'\
display_errors=On\n\
error_reporting=E_ALL\n\
date.timezone=UTC\n\
' >> /usr/local/etc/php/conf.d/php.ini

ENV COMPOSER_ALLOW_SUPERUSER 1

RUN curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \
mv composer.phar /usr/local/bin/composer && \
echo $'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.profile
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ test-coverage: test-dependencies
test-coveralls: test-dependencies
@mkdir -p build/logs
@$(PHPUNIT) --coverage-clover build/logs/clover.xml

.PHONY: test-container-56
test-container-56:
@docker-compose run --rm app56 sh
@docker-compose down

.PHONY: test-container-74
test-container-74:
@docker-compose run --rm app74 sh
@docker-compose down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ The project is continuously tested by [GitHub actions](https://github.com/ICanBo



## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.



## License

**ICanBoogie/DateTime** is released under the [BSD-3-Clause](LICENSE).
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
version: "3.0"
services:
app56:
build:
context: .
args:
PHP_VERSION: 5.6
environment:
PHP_IDE_CONFIG: "serverName=icanboogie-datetime"
volumes:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app
app74:
build:
context: .
args:
PHP_VERSION: 7.4
environment:
PHP_IDE_CONFIG: "serverName=icanboogie-datetime"
volumes:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app

0 comments on commit c645e01

Please sign in to comment.