mirror of
https://github.com/elyby/accounts.git
synced 2024-11-16 18:23:29 +05:30
f33439d829
Build nginx and mariadb together with the app image. Upgrade docker-compose configuration to 3 version. Add cleanup step to the gitlab-ci.
154 lines
3.3 KiB
YAML
154 lines
3.3 KiB
YAML
version: '3.4'
|
|
services:
|
|
web:
|
|
image: registry.ely.by/elyby/accounts-nginx:latest
|
|
build:
|
|
context: .
|
|
target: web
|
|
args:
|
|
build_env: dev
|
|
depends_on:
|
|
- app
|
|
env_file: .env
|
|
volumes:
|
|
- ./:/var/www/html
|
|
networks:
|
|
- default
|
|
- nginx-proxy
|
|
|
|
app:
|
|
image: registry.ely.by/elyby/accounts:dev
|
|
build:
|
|
context: .
|
|
args:
|
|
build_env: dev
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
volumes:
|
|
- ./:/var/www/html
|
|
env_file: .env
|
|
networks:
|
|
default:
|
|
aliases:
|
|
- php
|
|
|
|
worker:
|
|
image: registry.ely.by/elyby/accounts:dev
|
|
build:
|
|
context: .
|
|
args:
|
|
build_env: dev
|
|
command: ['php', 'yii', 'queue/listen', '-v']
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
volumes:
|
|
- ./:/var/www/html
|
|
env_file: .env
|
|
|
|
cron:
|
|
image: registry.ely.by/elyby/accounts:dev
|
|
build:
|
|
context: .
|
|
args:
|
|
build_env: dev
|
|
command: ['crond', '-s', '/etc/cron.d', '-f', '-L', '/var/log/cron.log']
|
|
stop_signal: SIGKILL
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
volumes:
|
|
- ./:/var/www/html
|
|
env_file: .env
|
|
|
|
db:
|
|
build:
|
|
context: .
|
|
target: db
|
|
args:
|
|
build_env: dev
|
|
env_file: .env
|
|
volumes:
|
|
- ./data/mysql:/var/lib/mysql
|
|
|
|
redis:
|
|
image: redis:3.0-alpine
|
|
volumes:
|
|
- ./data/redis:/data
|
|
|
|
# If you want to use separate databases for the tests follow the next steps:
|
|
# 1) Create a file common/config/config-local.php with the next containment:
|
|
#
|
|
# <?php
|
|
# if (YII_ENV !== 'test') {
|
|
# return [];
|
|
# }
|
|
#
|
|
# return [
|
|
# 'components' => [
|
|
# 'db' => [
|
|
# 'dsn' => 'mysql:host=testdb;dbname=test',
|
|
# 'username' => 'test',
|
|
# 'password' => 'test',
|
|
# ],
|
|
# 'unbufferedDb' => [
|
|
# 'dsn' => 'mysql:host=testdb;dbname=test',
|
|
# 'username' => 'test',
|
|
# 'password' => 'test',
|
|
# ],
|
|
# 'redis' => [
|
|
# 'hostname' => 'testredis',
|
|
# 'password' => null,
|
|
# 'port' => 6379,
|
|
# 'database' => 0,
|
|
# ],
|
|
# ],
|
|
# ];
|
|
#
|
|
# 2) Clone api/tests/functional.suite.dist.yml into api/test/functional.suite.yml
|
|
# and adjust Redis module host value to the "testredis".
|
|
#
|
|
# 3) Uncomment the next 2 services (testdb and testredis):
|
|
#
|
|
# testdb:
|
|
# build:
|
|
# context: .
|
|
# target: db
|
|
# args:
|
|
# build_env: dev
|
|
# volumes:
|
|
# - ./data/mysql-test:/var/lib/mysql
|
|
# environment:
|
|
# - MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
|
# - MYSQL_ROOT_PASSWORD=
|
|
# - MYSQL_DATABASE=test
|
|
# - MYSQL_USER=test
|
|
# - MYSQL_PASSWORD=test
|
|
#
|
|
# testredis:
|
|
# image: redis:3.0-alpine
|
|
# volumes:
|
|
# - ./data/redis-test:/data
|
|
#
|
|
# 4) To run migrations on tests database you must execute slightly adjusted
|
|
# migrate command: env YII_ENV=test yii migrate
|
|
|
|
phpmyadmin:
|
|
build: ./docker/phpmyadmin
|
|
environment:
|
|
- PMA_ARBITRARY=1
|
|
- PMA_USER=root
|
|
- PMA_PASSWORD=
|
|
- VIRTUAL_HOST=pma.account.ely.by.local # Feel free to adjust this domain
|
|
depends_on:
|
|
- db
|
|
networks:
|
|
- default
|
|
- nginx-proxy
|
|
|
|
networks:
|
|
nginx-proxy:
|
|
external:
|
|
name: nginx-proxy
|