Skip to content

Commit 7f6bb91

Browse files
committed
small improvements to docker setup
1 parent 2bb3340 commit 7f6bb91

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ USER=$$(whoami)
44
DOCKER=docker-compose exec --user=$(USER) backend-php
55
# The PHP binary to use, you may add arguments to PHP here
66
PHP=php
7+
# directories writeable by webserver
8+
WRITEABLE_DIRS=/app/runtime /app/logs /app/backend/web/assets
79

810

911
# default target lists general usage information
@@ -43,9 +45,12 @@ bash: cli
4345
cli:
4446
$(DOCKER) bash
4547

46-
start-docker: config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php
48+
start-docker: config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
4749
docker-compose up -d
48-
$(DOCKER) sh -c 'cd /app && composer install'
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"
52+
docker-compose exec -T backend-php bash -c "chgrp -R www-data $(WRITEABLE_DIRS) && chmod -R g+w $(WRITEABLE_DIRS)"
53+
$(DOCKER) sh -c 'cd /app && composer install --no-progress --no-interaction --ansi'
4954
@echo ""
5055
@echo "API: http://localhost:8337/"
5156
# @echo "API docs: http://localhost:8337/docs/index.html" # not yet :)

api/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM yiisoftware/yii2-php:7.3-apache
1+
FROM yiisoftware/yii2-php:7.4-apache
22

33
COPY config/apache.conf /etc/apache2/sites-enabled/000-default.conf

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM yiisoftware/yii2-php:7.3-apache
1+
FROM yiisoftware/yii2-php:7.4-apache
22

33
COPY config/apache.conf /etc/apache2/sites-enabled/000-default.conf

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"platform": {"php": "7.1.3"},
2323
"fxp-asset": {
2424
"enabled": false
25+
},
26+
"allow-plugins": {
27+
"yiisoft/yii2-composer": true
2528
}
2629
},
2730
"repositories": [

0 commit comments

Comments
 (0)