Skip to content

Commit

Permalink
👷 docker support for OSS contributors (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath authored Jun 27, 2023
1 parent 80ef578 commit 54f9027
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/.github export-ignore
/art export-ignore
/docker export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
CONTRIBUTING.md export-ignore
docker-compose.yml export-ignore
LICENSE.md export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,20 @@ Unit tests:
```bash
composer test:unit
```

## Simplified setup using Docker

If you have Docker installed, you can quickly get all dependencies for jira-laravel in place using Docker files. Assuming you have the repository cloned, you may run the following
commands:

1. `docker compose build` to build the Docker image
2. `docker compose run --rm composer install` to install Composer dependencies
3. `docker compose run --rm composer test` to run the project tests and analysis tools

If you want to check things work against a specific version of PHP, you may include the `PHP` build argument when building the image:

```bash
docker compose build --build-arg PHP=8.2
```

The default PHP version will always be the lowest version of PHP supported by jira-laravel.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.8.6",
"phpstan/phpstan-strict-rules": "^1.4",
"rector/rector": "^0.14.4",
"rector/rector": "^0.15",
"symfony/var-dumper": "^6.2.0"
},
"autoload": {
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.8"

services:
php:
build:
context: ./docker
volumes:
- .:/var/www/html
composer:
build:
context: ./docker
volumes:
- .:/var/www/html
entrypoint: ["composer"]
23 changes: 23 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG PHP=8.1
FROM php:${PHP}-cli-alpine

RUN apk update \
&& apk add zip libzip-dev icu-dev git

RUN docker-php-ext-configure zip
RUN docker-php-ext-install zip
RUN docker-php-ext-enable zip

RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN docker-php-ext-enable intl

RUN apk add --no-cache $PHPIZE_DEPS linux-headers
RUN pecl install pcov
RUN docker-php-ext-enable pcov

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

ENTRYPOINT ["php"]
1 change: 0 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
SetList::TYPE_DECLARATION_STRICT,
SetList::EARLY_RETURN,
LevelSetList::UP_TO_PHP_81,
]);
Expand Down

0 comments on commit 54f9027

Please sign in to comment.