Skip to content

Commit 3130dcd

Browse files
committed
build: add docker files
1 parent 05e224b commit 3130dcd

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,34 @@ $response = $mta->getResource('someResource')->call->callableFunction($arg1, $ar
5555

5656
var_dump($response);
5757
```
58+
59+
# Development environment setup
60+
61+
**Prerequisites**:
62+
- [docker-compose](https://docs.docker.com/compose/install/)
63+
64+
First, we need to build the local docker image. To do this, run the following command:
65+
66+
$ docker-compose build
67+
68+
We will be using an alias for executing the development commands.
69+
70+
$ alias dcli='docker-compose -f docker-compose.cli.yml run --rm'
71+
72+
**Install dependencies**:
73+
74+
$ dcli composer install
75+
76+
## Running tests
77+
78+
To run the project tests and validate the coding standards:
79+
80+
$ dcli composer test
81+
82+
To run all unit tests you can use:
83+
84+
$ dcli phpunit
85+
86+
To run specific unit test you can use --filter option:
87+
88+
$ dcli phpunit --filter=ClassName::MethodName

docker-compose.cli.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3.7'
2+
services:
3+
composer:
4+
image: multitheftauto/mtasa-php-sdk:latest
5+
init: true
6+
volumes:
7+
- .:/application
8+
- composer-cache:/root/.composer/cache
9+
entrypoint: composer
10+
11+
phpunit:
12+
image: multitheftauto/mtasa-php-sdk:latest
13+
init: true
14+
volumes:
15+
- .:/application
16+
entrypoint: vendor/bin/phpunit
17+
18+
php:
19+
image: multitheftauto/mtasa-php-sdk:latest
20+
init: true
21+
volumes:
22+
- .:/application
23+
24+
volumes:
25+
composer-cache:
26+
name: composer-cache

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3.7'
2+
services:
3+
php:
4+
build:
5+
context: .
6+
dockerfile: docker/Dockerfile
7+
image: multitheftauto/mtasa-php-sdk:latest

docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM php:7.1-cli
2+
3+
RUN pecl install xdebug \
4+
&& docker-php-ext-enable xdebug
5+
6+
# Install unzip for composer dependencies
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends unzip \
9+
&& apt-get autoremove -y
10+
11+
ENV COMPOSER_ALLOW_SUPERUSER 1
12+
ENV COMPOSER_HOME /root/.composer
13+
14+
COPY --from=composer:1.10.10 /usr/bin/composer /usr/bin/composer
15+
16+
WORKDIR /application
17+
18+
CMD ["php"]

0 commit comments

Comments
 (0)