Skip to content

Commit

Permalink
👷 docker support for OSS contributors (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath committed Jun 27, 2023
1 parent d93c5de commit f9ab0bf
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 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 jql-builder 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 jql-builder.
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.0
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"]

0 comments on commit f9ab0bf

Please sign in to comment.