The docker-compose file has been updated to utilize environment variables for the MongoDB and MySQL ports. Instead of hard-coding the port numbers, the system now dynamically fetches port values from the .env file, which increases versatility and configurability.
35 lines
739 B
YAML
35 lines
739 B
YAML
services:
|
|
|
|
#serveur de base de donnees
|
|
mariadb:
|
|
image: 'mariadb:latest'
|
|
env_file:
|
|
- ./.env
|
|
restart: always
|
|
environment:
|
|
MYSQL_USER: ${MYSQL_USERNAME}
|
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
|
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
|
|
|
ports:
|
|
- '${MYSQL_PORT}:3306'
|
|
volumes:
|
|
- ./mariadb/:/var/lib/mysql/
|
|
|
|
mongodb:
|
|
image: 'mongo:latest'
|
|
env_file:
|
|
- ./.env
|
|
ports:
|
|
- '${MONGO_PORT}:27017'
|
|
restart: always
|
|
logging:
|
|
options:
|
|
max-size: 1g
|
|
environment:
|
|
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME}
|
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
|
|
volumes:
|
|
- ./mongodb:/data/db
|