From 0df7f9dc70746d0233708372853ab1dabeb1f3c6 Mon Sep 17 00:00:00 2001 From: Stan Yakubenko Date: Fri, 20 Nov 2020 09:53:34 +0500 Subject: [PATCH] Add: Makefile example. Config fixes. --- .env.dist | 1 + .gitignore | 1 + Makefile.example | 28 ++++++++++++++++++++++++++++ README.md | 3 +++ docker-compose.dist.yml | 6 +++--- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Makefile.example create mode 100644 README.md diff --git a/.env.dist b/.env.dist index 15b4454..dfd6357 100644 --- a/.env.dist +++ b/.env.dist @@ -1,3 +1,4 @@ +PROJECT_DIR=. # all container will be appended with this APP_NAME=dev_station # default user/password pair for all services diff --git a/.gitignore b/.gitignore index 9fabd9b..27f17d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode/ .env docker-compose.yml +Makefile diff --git a/Makefile.example b/Makefile.example new file mode 100644 index 0000000..7fe3406 --- /dev/null +++ b/Makefile.example @@ -0,0 +1,28 @@ +# based on https://github.com/krom/docker-compose-makefile +DOCKER_COMPOSE:=docker-compose +DOCKER_COMPOSE_FILE:=docker-compose.yml +ENV_FILE:=.env + +.PHONY: help up start stop restart status ps down + +status: ## Show status of containers + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) ps + +up: ## Start all or c= containers in foreground + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) up $(c) + +start: ## Start all or c= containers in background + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) up -d $(c) + +stop: ## Stop all or c= containers + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) stop $(c) + +restart: ## Restart all or c= containers + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) stop $(c) + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) up $(c) -d + +logs: ## Show logs for all or c= containers + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) logs --tail=100 -f $(c) + +down: ## Clean all data + @$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) down diff --git a/README.md b/README.md new file mode 100644 index 0000000..dfae8dd --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# DOCKER ZOO + +Get your local PHP development environment set up in minutes. diff --git a/docker-compose.dist.yml b/docker-compose.dist.yml index 411b1e4..6568a48 100644 --- a/docker-compose.dist.yml +++ b/docker-compose.dist.yml @@ -10,7 +10,7 @@ services: ports: - ${NGINX_PORT}:80 volumes: - - .:/var/www + - ${PROJECT_DIR}:/var/www - ./docker/nginx/default:/etc/nginx/conf.d/default.conf phpfpm: @@ -18,7 +18,7 @@ services: container_name: phpfpm_${APP_NAME} restart: 'no' volumes: - - .:/var/www + - ${PROJECT_DIR}:/var/www - ./docker/php-fpm/php.ini:/etc/php/7.4/php.ini - ./docker/php-fpm/xdebug.ini:/etc/php/7.4/mods-available/xdebug.ini - ./docker/php-fpm/supervisor.conf:/etc/supervisor/supervisor_nodeamon.conf @@ -59,7 +59,7 @@ services: - ./mysql/mysql.conf.d:/etc/mysql/conf.d/ - mysql_legacy:/var/lib/mysql environment: - MYSQL_TCP_PORT: ${ZOO_MYSQL_LEGACY_PORT} + MYSQL_TCP_PORT: ${MYSQL_LEGACY_PORT} MYSQL_ROOT_PASSWORD: ${PASSWORD} mysql: