From f9ab0bf73030525324b6b84e25b3bc7879cd8dbf Mon Sep 17 00:00:00 2001 From: Moath Date: Tue, 27 Jun 2023 07:08:20 +0300 Subject: [PATCH] :construction_worker: docker support for OSS contributors (#34) --- .gitattributes | 2 ++ CONTRIBUTING.md | 17 +++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ docker/Dockerfile | 23 +++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile diff --git a/.gitattributes b/.gitattributes index b5ca527..abf7c89 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf9daee..32e91ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fee8d3d --- /dev/null +++ b/docker-compose.yml @@ -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"] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e521d27 --- /dev/null +++ b/docker/Dockerfile @@ -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"] \ No newline at end of file