1- version : " 3.9"
2-
31services :
42 app :
53 build : .
@@ -9,24 +7,30 @@ services:
97 - " 8081:80"
108 environment :
119 # Database connection (mirrors config/parameters.yml expectations)
12- PHPLIST_DATABASE_DRIVER : pdo_mysql
13- PHPLIST_DATABASE_HOST : db
14- PHPLIST_DATABASE_PORT : 3306
10+ # PHPLIST_DATABASE_DRIVER: pdo_mysql
11+ # PHPLIST_DATABASE_HOST: db
12+ # PHPLIST_DATABASE_PORT: 3306
1513 PHPLIST_DATABASE_NAME : phplistdb
1614 PHPLIST_DATABASE_USER : phplist
1715 PHPLIST_DATABASE_PASSWORD : phplist
16+ # To use PostgreSQL instead, override these (e.g. with `-e` or a compose override file):
17+ PHPLIST_DATABASE_DRIVER : pdo_pgsql
18+ PHPLIST_DATABASE_HOST : postgres
19+ PHPLIST_DATABASE_PORT : 5432
1820 # Symfony environment
1921 APP_ENV : prod
2022 APP_DEBUG : " 0"
2123 depends_on :
2224 - db
25+ networks : [ appnet ]
26+
2327 # Uncomment to persist logs/cache outside container
2428 # volumes:
2529 # - ./var:/var/www/html/var
2630
2731 db :
2832 image : mysql:8.0
29- container_name : base-distribution-db
33+ container_name : base-distribution-mysql
3034 environment :
3135 MYSQL_DATABASE : phplistdb
3236 MYSQL_USER : phplist
@@ -40,6 +44,29 @@ services:
4044 interval : 10s
4145 timeout : 5s
4246 retries : 10
47+ networks : [appnet]
48+
49+ postgres :
50+ image : postgres:15
51+ container_name : base-distribution-postgres
52+ environment :
53+ POSTGRES_DB : phplistdb
54+ POSTGRES_USER : phplist
55+ POSTGRES_PASSWORD : phplist
56+ volumes :
57+ - pg_data:/var/lib/postgresql/data
58+ healthcheck :
59+ test : ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB || exit 1"]
60+ interval : 10s
61+ timeout : 5s
62+ retries : 10
63+ networks : [ appnet ]
64+ # command to import data from mysql to postgres
65+ # docker run --rm --network base-distribution_appnet dimitri/pgloader:latest pgloader mysql://phplist:phplist@base-distribution-mysql:3306/phplistdb postgresql://phplist:phplist@base-distribution-postgres:5432/phplistdb
4366
4467volumes :
4568 db_data :
69+ pg_data :
70+
71+ networks :
72+ appnet :
0 commit comments