Skip to content

Commit 1dfb217

Browse files
committed
improve docker stack
1 parent 1aa2708 commit 1dfb217

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ bash: cli
4545
cli:
4646
$(DOCKER) bash
4747

48-
start-docker: runtime/build-docker config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
48+
start-docker: docker-compose.override.yml runtime/build-docker config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
4949
docker-compose up -d
50-
docker-compose exec -T backend-php bash -c "grep '^$(shell whoami):' /etc/passwd || useradd -m '$(shell whoami)' --uid=$(shell id -u) -G www-data -s /bin/bash"
51-
docker-compose exec -T backend-php bash -c "sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /home/$(shell whoami)/.bashrc && sed -i 's~etc/bash_completion~etc/bash_completion.d/yii~' /home/$(shell whoami)/.bashrc"
50+
docker-compose exec -T backend-php bash -c "grep '^$(shell whoami):' /etc/passwd || useradd -m '$(shell whoami)' --uid=$(shell id -u) -G www-data -s /bin/bash -d /app/runtime/home"
51+
docker-compose exec -T backend-php bash -c "sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /app/runtime/home/.bashrc && sed -i 's~etc/bash_completion~etc/bash_completion.d/yii~' /app/runtime/home/.bashrc"
5252
docker-compose exec -T backend-php bash -c "chgrp -R www-data $(WRITEABLE_DIRS) && chmod -R g+w $(WRITEABLE_DIRS)"
5353
$(DOCKER) sh -c 'cd /app && composer install --no-progress --no-interaction --ansi'
5454
@echo ""
@@ -70,5 +70,7 @@ config/components-%.local.php: config/components-ENV.local.php
7070
test -f $@ || cp $< $@
7171
env.php: env.php.dist
7272
test -f $@ || cp $< $@
73+
docker-compose.override.yml: docker-compose.override.dist.yml
74+
test -f $@ || cp $< $@
7375
backend/config/cookie-validation.key:
7476
test -s $@ || php -r 'echo bin2hex(random_bytes(20));' > $@

config/gii-generators.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
*/
66
return [
77
'api' => [
8-
'class' => \cebe\yii2openapi\generator\ApiGenerator::class,
9-
'urlConfigFile' => '@api/config/url-rules.rest.php',
10-
'controllerNamespace' => 'api\\controllers',
11-
'modelNamespace' => 'common\\models',
12-
'migrationPath' => '@common/migrations',
8+
'class' => \cebe\yii2openapi\generator\ApiGenerator::class,
9+
'urlConfigFile' => '@api/config/url-rules.rest.php',
10+
'controllerNamespace' => 'api\\controllers',
11+
'modelNamespace' => 'common\\models',
12+
'fakerNamespace' => 'common\\models\\faker',
13+
'migrationPath' => '@common/migrations',
14+
1315
],
1416
];

docker-compose.override.dist.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Development stack overrides
2+
#
3+
# Variables are populated with values from `.env`
4+
#
5+
version: '2'
6+
services:
7+
api-php:
8+
ports:
9+
- '8337:80'
10+
11+
backend-php:
12+
ports:
13+
- '8338:80'
14+
volumes:
15+
# Re-use local composer cache via host-volume
16+
- ~/.composer-docker/cache:/root/.composer/cache:delegated
17+
18+
db:
19+
volumes:
20+
- ./runtime/mariadb-data:/var/lib/mysql
21+
ports:
22+
- '3386:3306'
23+
24+
mailcatcher:
25+
ports:
26+
- '8055:1080'

0 commit comments

Comments
 (0)