Skip to content

Commit 8d6620a

Browse files
committed
Docker: Move compose file on .docker/compose
1 parent 85a3d5d commit 8d6620a

File tree

4 files changed

+30
-57
lines changed

4 files changed

+30
-57
lines changed

docker-compose.dev.yml renamed to .docker/compose/base-dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.6'
22
services:
33
db:
44
build:
5-
context: .docker/mysql
5+
context: ../mysql
66
args:
77
MYSQL_USER: ${DB_USER}
88
MYSQL_PASSWORD: ${DB_PASS}
@@ -27,8 +27,8 @@ services:
2727
ports:
2828
- 80
2929
volumes:
30-
- ./.docker/phpmyadmin/config.inc.php:/etc/phpmyadmin/config.user.inc.php
31-
- ./.docker/phpmyadmin/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
30+
- ./../phpmyadmin/config.inc.php:/etc/phpmyadmin/config.user.inc.php
31+
- ./../phpmyadmin/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
3232
depends_on:
3333
- db
3434
links:

docker-compose.yml renamed to .docker/compose/base.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ services:
1212
- 80
1313
- 443
1414
volumes:
15-
- ./project:/var/www/project/demo
16-
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf
17-
- ./.docker/nginx/sites:/etc/nginx/sites-enabled
15+
- ../../project:/var/www/project/demo
16+
- ../nginx/nginx.conf:/etc/nginx/nginx.conf
17+
- ../nginx/sites:/etc/nginx/sites-enabled
1818
restart: unless-stopped
1919
depends_on:
2020
- php
@@ -39,7 +39,7 @@ services:
3939
- sfdemo
4040

4141
php:
42-
build: .docker/php
42+
build: ../php
4343
restart: unless-stopped
4444
environment:
4545
MYSQL_HOST: ${DB_HOST}
@@ -48,7 +48,7 @@ services:
4848
MYSQL_PORT: ${DB_PORT}
4949
MYSQL_DATABASE: ${DB_NAME}
5050
volumes:
51-
- ./project:/var/www/project/demo
51+
- ../../project:/var/www/project/demo
5252
- ~/.cache/composer:/.composer # Share composer cache
5353
depends_on:
5454
- db

.env.dist

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,14 @@
1-
# In all environments, the following files are loaded if they exist,
2-
# the later taking precedence over the former:
3-
#
4-
# * .env contains default values for the environment variables needed by the app
5-
# * .env.local uncommitted file with local overrides
6-
# * .env.$APP_ENV committed environment-specific defaults
7-
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8-
#
9-
# Real environment variables win over .env files.
10-
#
11-
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12-
#
13-
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
14-
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
15-
16-
###> symfony/framework-bundle ###
17-
APP_ENV=dev
18-
APP_SECRET=1c033cf04c8c84f016ffa88768ee165a
19-
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
20-
#TRUSTED_HOSTS='^localhost|example\.com$'
21-
###< symfony/framework-bundle ###
1+
# Docker Configuration
2+
COMPOSE_PATH_SEPARATOR=;
3+
COMPOSE_PROJECT_NAME=sfdemo
4+
COMPOSE_FILE=.docker/compose/base.yml;.docker/compose/base-dev.yml
5+
# VOLUME_USER_ID=1001 # You can set your Linux UserID (command: id -u)
6+
# COMPOSER_HOME=/home/$user/.cache/composer/ # You can set your composer folder, change $user by your username
227

23-
###> doctrine/doctrine-bundle ###
24-
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
25-
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
26-
#
8+
# Database Configuration
279
DB_HOST=db
2810
DB_PORT=3306
2911
DB_NAME=demo
3012
DB_USER=local
3113
DB_PASS=local
32-
DATABASE_URL=mysql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=8
33-
TIMEZONE=Europe/Paris
34-
###< doctrine/doctrine-bundle ###
35-
36-
###> Docker config ###
37-
COMPOSE_PROJECT_NAME=sfdemo
38-
# VOLUME_USER_ID=1001 # You can set your Linux UserID (command: id -u)
39-
# COMPOSER_HOME=/home/$user/.cache/composer/ # You can set your composer folder, change $user by your username
40-
41-
# A transférer dans doctrine
42-
MYSQL_DATABASE=demo
43-
MYSQL_USER=local
44-
MYSQL_PASSWORD=local
45-
MYSQL_PORT=3306
46-
###< Docker database conf ###
14+
TIMEZONE=Europe/Paris

Makefile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ uninstall: clear stop ## Remove docker containers
6565
reset: uninstall install ## Remove and re-create docker containers
6666

6767
clear-cache: perm ## Clear + Prepare Cache (alias: c:c), you can specify the env: ENV=prod
68-
@$(CONSOLE) cache:clear --no-warmup --env=$(APP_ENV)
69-
@$(CONSOLE) cache:warmup --env=$(APP_ENV)
68+
@$(CONSOLE) cache:clear --no-warmup
69+
@$(CONSOLE) cache:warmup
7070

7171
c\:c: clear-cache
7272

@@ -110,10 +110,10 @@ db-create-migration: ## Create migration
110110
@$(CONSOLE) make:migration
111111

112112
db-migrate: ## Migrate database schema to the latest available version
113-
@$(CONSOLE) doctrine:migration:migrate -n --env=$(APP_ENV)
113+
@$(CONSOLE) doctrine:migration:migrate -n
114114

115115
db-rollback: ## Rollback the latest executed migration
116-
@$(CONSOLE) doctrine:migration:migrate prev -n --env=$(APP_ENV)
116+
@$(CONSOLE) doctrine:migration:migrate prev -n
117117

118118
db-validate: ## Check the ORM mapping
119119
@$(CONSOLE) doctrine:schema:validate
@@ -122,7 +122,7 @@ db-create-database: ## Create database if not exists
122122
@$(CONSOLE) doctrine:database:create --if-not-exists
123123

124124
db-fixtures: ## Apply doctrine fixtures
125-
@$(CONSOLE) doctrine:fixtures:load -n --env=$(APP_ENV)
125+
@$(CONSOLE) doctrine:fixtures:load -n
126126

127127
db-install: db-create-database db-migrate db-fixtures ## Drop and install database with schema + fixtures
128128

@@ -207,13 +207,18 @@ define echo_text
207207
echo -e '\e[1;$(2)m$(1)\e[0m'
208208
endef
209209

210-
docker-compose.override.yml: docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml
210+
docker-compose.override.yml:
211211
ifeq (,$(wildcard .env))
212212
@cp .env.dist .env
213213
endif
214-
@test -f docker-compose.override.yml \
215-
&& $(call echo_text,/!\ docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml might have been modified - remove docker-compose.override.yml to be up-to-date,31) \
216-
|| ( echo "Copy docker-compose.override.yml from docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml"; cp docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml docker-compose.override.yml )
214+
215+
#docker-compose.override.yml: docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml
216+
#ifeq (,$(wildcard .env))
217+
# @cp .env.dist .env
218+
#endif
219+
# @test -f docker-compose.override.yml \
220+
# && $(call echo_text,/!\ docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml might have been modified - remove docker-compose.override.yml to be up-to-date,31) \
221+
# || ( echo "Copy docker-compose.override.yml from docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml"; cp docker-compose.$(DOCKER_COMPOSE_OVERRIDE).yml docker-compose.override.yml )
217222

218223

219224
#node_modules: yarn.lock

0 commit comments

Comments
 (0)