Skip to content

Commit f6c7af1

Browse files
committed
Makefile: add current user/group, fix #3
1 parent f102fbf commit f6c7af1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ ifneq ("$(wildcard .env)","")
55
endif
66

77
# Init var
8-
DOCKER_COMPOSE?=docker-compose
8+
user := $(shell id -u)
9+
group := $(shell id www-data -g)
10+
DOCKER_COMPOSE := USER_ID=$(user) GROUP_ID=$(group) docker-compose
911
EXEC?=$(DOCKER_COMPOSE) exec php
1012
EXEC_ROOT?=$(DOCKER_COMPOSE) exec -u root php
1113
CONSOLE=bin/console
@@ -41,6 +43,12 @@ install-demo:
4143
@$(EXEC_ROOT) bash -c "mv demo/* . && rm -rf demo/ data/"
4244
@make restart perm db-create-migration db-install clear-cache
4345

46+
install-prod:
47+
APP_ENV=prod APP_DEBUG=0 $(call composer,install --no-dev --optimize-autoloader)
48+
APP_ENV=prod make clear-cache
49+
APP_ENV=prod APP_DEBUG=0 @$(EXEC) $(CONSOLE) cache:clear
50+
@$(EXEC) $(CONSOLE) cache:pool:clear cache.global_clearer
51+
4452
status: ## Docker container status
4553
@$(DOCKER_COMPOSE) ps
4654

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
- ./project:/var/www
1616
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf
1717
- ./.docker/nginx/demo.conf:/etc/nginx/sites-enabled/demo.conf
18-
restart: always
18+
restart: unless-stopped
1919
depends_on:
2020
- php
2121
networks:
@@ -26,7 +26,7 @@ services:
2626
db:
2727
image: mysql:8
2828
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
29-
restart: always
29+
restart: unless-stopped
3030
environment:
3131
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
3232
MYSQL_DATABASE: ${MYSQL_DATABASE}
@@ -40,7 +40,7 @@ services:
4040

4141
php:
4242
build: .docker/php
43-
restart: always
43+
restart: unless-stopped
4444
environment:
4545
MYSQL_HOST: db
4646
MYSQL_USER: ${MYSQL_USER}

0 commit comments

Comments
 (0)