Skip to content

Commit

Permalink
Merge pull request #28 from LinioIT/build/add-docker-for-local-develo…
Browse files Browse the repository at this point in the history
…pment

[SCP-488] build: add docker for local development
  • Loading branch information
ecastro98 authored Aug 18, 2020
2 parents efe91e0 + 3a55f50 commit 6a21725
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Edit your composer.json to add the repository URL:

Then require the package:

$ composer require linio/seller-center-SDK
$ composer require linio/seller-center-sdk

Quick start
-----
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.7'
services:
php-cs-fixer:
image: linio/seller-center-sdk:latest
init: true
volumes:
- .:/application
entrypoint: vendor/bin/php-cs-fixer
command: fix --verbose --show-progress=estimating

composer:
image: linio/seller-center-sdk:latest
init: true
volumes:
- .:/application
entrypoint: composer

php:
image: linio/seller-center-sdk:latest
init: true
volumes:
- .:/application
environment:
LINIO_ENV: local
14 changes: 4 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
version: '2'
version: '3.7'
services:
app:
php:
build:
context: .
dockerfile: .docker/Dockerfile
image: sdk-docker
ports:
- 8080:80
volumes:
- .:/var/www
env_file:
- .docker/.env
dockerfile: docker/Dockerfile
image: linio/seller-center-sdk:latest
18 changes: 18 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM php:7.1-cli

RUN pecl install xdebug \
&& docker-php-ext-enable xdebug

# Install unzip for composer dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends unzip \
&& apt-get autoremove -y

ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /root/.composer

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

WORKDIR /application

CMD ["php"]
20 changes: 18 additions & 2 deletions docs/Contribute/Tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,30 @@ A string with the format written above for getting orders updated before that da
```
A valid order item ID in the environment for get its document.

## Local setup

**Prerequisites**:
- [docker-compose](https://docs.docker.com/compose/install/)

First, we need to build the local docker image. To do this, run the following command:

> `docker-compose build`
We will be using an alias for executing the development commands.

> `alias dcli='docker-compose -f docker-compose.cli.yml run --rm'`
**Install dependencies**:

> `dcli composer install`
Running tests
-------------

To run the project tests and validate the coding standards:

$ composer test
$ dcli composer test

To run specific unit tests you can use --filter option:

$ php vendor/bin/phpunit --filter=ClassName::MethodName
$ dcli php vendor/bin/phpunit --filter=ClassName::MethodName

0 comments on commit 6a21725

Please sign in to comment.