Skip to content

Commit

Permalink
Merge pull request #73 from Trusted97/feat/add-docker-enviroment
Browse files Browse the repository at this point in the history
feat: add docker enviroment
  • Loading branch information
DavidePastore authored Sep 24, 2024
2 parents 6c3d94f + 48817e3 commit bae5436
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 5 deletions.
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contributing

## Quick Guide

1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local machine.
2. Install the dependencies (`composer install --dev`)
3. Create a new branch (`git checkout -b feat/new-feature`)
4. Write your feature or fix and make sure tests pass and code standards are met (see below)
5. Commit your changes (`git commit -m 'feat(new-feature): some feature or fix'`)
6. Push to the branch (`git push origin feat/new-feature`)
7. Open a pull request

## Working with Docker 🐳

This project provides a Docker setup that allows working on it using any of the supported PHP versions.

To use it, you first need to install:

* [Docker](https://docs.docker.com/get-docker/)
* [Docker Compose](https://docs.docker.com/compose/install/)

Make sure the versions installed support [Compose file format 3.9](https://docs.docker.com/compose/compose-file/).

You can then build the images:

```console
docker compose up --build -d
```

Now you can run commands needed to work on the project. For example, say you want to install the dependencies on PHP 8.0:

```console
docker-compose run codice-fiscale-php-80 composer install
```

or for enter the container

```console
docker-compose exec codice-fiscale-php-80 sh
```

## Testing

To run the test use the command below:

```bash
composer test
```
2 changes: 1 addition & 1 deletion README-it.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Test
----

``` bash
$ vendor\bin\phpunit
$ composer test
```


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Test
----

``` bash
$ vendor\bin\phpunit
$ composer test
```


Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@
"name": "davidepastore",
"email": "pasdavide@gmail.com"
}
]
],
"config": {
"sort-packages": true
},
"scripts": {
"test": "vendor/bin/phpunit"
}
}
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3.9'

services:
codice-fiscale-71:
build: docker/php-7.1
container_name: codice-fiscale-php-71
working_dir: /app
tty: true
volumes:
- .:/app:cached

codice-fiscale-80:
build: docker/php-8.0
container_name: codice-fiscale-php-80
working_dir: /app
tty: true
volumes:
- .:/app:cached
3 changes: 3 additions & 0 deletions docker/php-7.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.1-alpine3.9

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
3 changes: 3 additions & 0 deletions docker/php-8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:8.0-cli-alpine3.16

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit bootstrap="./vendor/autoload.php">

<testsuites>
<testsuite name="The project's test suite">
<testsuite name="Codice Fiscale test suite">
<directory>./test</directory>
</testsuite>
</testsuites>
Expand All @@ -11,4 +11,4 @@
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>

0 comments on commit bae5436

Please sign in to comment.