Skip to content

Commit

Permalink
Add Docker & instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel de Wit committed Mar 27, 2023
1 parent 1ee6707 commit 4af7fbd
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/docker export-ignore
/stubs export-ignore
/tests export-ignore
/.coveralls.yml export-ignore
Expand All @@ -12,5 +13,7 @@
/.php-cs-fixer.dist.php export-ignore
/.php_cs.common.php export-ignore
/.php_cs.tests.php export-ignore
/docker-compose.yml export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
setup:
@test -s phpunit.xml || cp phpunit.xml.dist phpunit.xml
@docker-compose run --rm app composer install

destroy:
@docker-compose down --remove-orphans --volumes

app:
@docker-compose run --rm app sh

test:
@docker-compose run --rm app sh -c "php ./vendor/bin/phpunit"
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,32 @@ input LoginInput {
}
```

## Docker

Develop locally using [Docker](https://www.docker.com/) & [Docker Compose](https://docs.docker.com/compose/).

#### Setup
This will build the Docker image and prepare the container.

```bash
make setup
```
- CLI: `make app`
- Destroy: `make destroy`

#### CLI
Enter the container with shell to start developing.

```bash
make app
```

#### Destroy
Shutdown and remove the container.

```bash
make app
```

## Testing

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3.7'

services:
app:
build: docker
volumes:
- .:/var/www/html:cached
14 changes: 14 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:8.2-cli-alpine

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

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
&& pecl install \
pcov \
&& docker-php-ext-enable \
pcov

COPY conf.d /usr/local/etc/php/conf.d

WORKDIR /var/www/html
1 change: 1 addition & 0 deletions docker/conf.d/memory-limit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = -1

0 comments on commit 4af7fbd

Please sign in to comment.