Skip to content

Commit 9d2d766

Browse files
Legion112Maxim Ageev
andauthored
Docker config (#179)
* [ENHANCEMENT] Add `.phpunit.result.cache` to ignore (cherry picked from commit d250471) * [ENHANCEMENT] add docker-compose for easy jump in development (cherry picked from commit d03b46d) * Makefile + Documentation --------- Co-authored-by: Maxim Ageev <maxim.ageev@paxful.com>
1 parent 2546d10 commit 9d2d766

File tree

7 files changed

+53
-0
lines changed

7 files changed

+53
-0
lines changed

.docker/Dockerfile.local

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM php:8.1-cli-alpine
2+
ENV XDG_CACHE_HOME=/tmp/.cache
3+
ENV COMPOSER_CACHE_DIR=${XDG_CACHE_HOME}/composer
4+
# posible could install cache directory here
5+
RUN --mount=type=bind,from=mlocati/php-extension-installer:1.5,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \
6+
install-php-extensions zip xdebug-stable
7+
RUN addgroup -S app && adduser -S app -G app
8+
RUN mkdir -p /app && chown -R app /app && mkdir -p /tmp && chown -R app /tmp
9+
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
10+
USER app
11+
WORKDIR /app

.docker/xdebug.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[xdebug]
2+
zend_extension="xdebug.so"
3+
xdebug.client_host=host.docker.internal
4+
xdebug.mode=debug

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
/.github export-ignore
55
/phpunit.xml.dist export-ignore
66
/tests export-ignore
7+
/.docker export-ignore
8+
/docker-compose.yaml export-ignore
9+
/Makefile export-ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.phar
44
*.iml
55
.idea/
66
coverage.xml
7+
.phpunit.result.cache

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
init:
2+
docker compose run cli composer i
3+
test:
4+
docker compose run cli vendor/bin/phpunit
5+
shell:
6+
docker compose run cli sh

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,20 @@ See [Guzzle Cache](https://www.drupal.org/project/guzzle_cache) module.
290290
# Links that talk about the project
291291
- [Speeding Up APIs/Apps/Smart Toasters with HTTP Response Caching](https://apisyouwonthate.com/blog/speeding-up-apis-apps-smart-toasters-with-http-response-caching)
292292
- [Caching HTTP-Requests with Guzzle 6 and PSR-6](http://a.kabachnik.info/caching-http-requests-with-guzzle-6-and-psr-6.html)
293+
294+
# Development
295+
296+
## Docker quick start
297+
298+
### Initialization
299+
```bash
300+
make init
301+
```
302+
### Running test
303+
```bash
304+
make test
305+
```
306+
### Entering container shell
307+
```bash
308+
make shell
309+
```

docker-compose.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3.9"
2+
services:
3+
cli:
4+
build:
5+
dockerfile: .docker/Dockerfile.local
6+
context: .
7+
working_dir: /app
8+
volumes:
9+
- ./:/app
10+
- ~/.composer/cache/:/tmp/cache/
11+
- ./.docker/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini:ro

0 commit comments

Comments
 (0)