Skip to content

Commit

Permalink
Run composer as nginx user to avoid permissions conflict. (#400)
Browse files Browse the repository at this point in the history
* Run composer as nginx user to avoid permissions conflict.

* Update Makefile

* add change ownership prior to starter-init

* Update Makefile

* Removed run as nginx since this these 2 are dropping into root's home dir

* Update Makefile
  • Loading branch information
DonRichards authored Aug 21, 2024
1 parent 6f08049 commit dc8ed0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ starter: QUOTED_CURDIR = "$(CURDIR)"
starter: generate-secrets
$(MAKE) starter-init ENVIRONMENT=starter
if [ -z "$$(ls -A $(QUOTED_CURDIR)/codebase)" ]; then \
docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'composer create-project $(CODEBASE_PACKAGE) /tmp/codebase; mv /tmp/codebase/* /home/root;'; \
docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'composer create-project $(CODEBASE_PACKAGE) /tmp/codebase && mv /tmp/codebase/* /home/root'; \
else \
docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'cd /home/root; composer install'; \
docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'cd /home/root && composer install'; \
fi
$(MAKE) set-files-owner SRC=$(CURDIR)/codebase ENVIRONMENT=starter
$(MAKE) compose-up
Expand All @@ -173,14 +173,14 @@ starter_dev: generate-secrets
fi
$(MAKE) set-files-owner SRC=$(CURDIR)/codebase ENVIRONMENT=starter_dev
$(MAKE) compose-up
docker compose exec -T drupal with-contenv bash -lc 'chown -R nginx:nginx /var/www/drupal/ ; su nginx -s /bin/bash -c "composer install"'
docker compose exec -T -u nginx drupal sh -c 'composer install'
$(MAKE) starter-finalize ENVIRONMENT=starter_dev


.PHONY: production
production: init
$(MAKE) compose-up
docker compose exec -T drupal with-contenv bash -lc 'composer install; chown -R nginx:nginx .'
docker compose exec -T -u nginx drupal sh -c 'composer install && chown -R nginx:nginx .'
$(MAKE) starter-finalize ENVIRONMENT=starter


Expand Down

0 comments on commit dc8ed0c

Please sign in to comment.