Improve Docker configuration

Do not leak environment variables of other containers, streamline configuration
This commit is contained in:
Cyril 2019-12-04 17:07:30 +01:00
parent 55396efe8a
commit dccfd57f7e
2 changed files with 28 additions and 15 deletions

View File

@ -1,18 +1,17 @@
# For the MariaDB container
MYSQL_ROOT_PASSWORD=notSoSecure
# The Davis database, user and password
MYSQL_DATABASE=davis
MYSQL_USER=davis_user
MYSQL_PASSWORD=davis_password
# For Davis
APP_ENV=prod
DATABASE_URL=mysql://davis_user:davis_password@mysql:3306/davis
# For the Davis app
DAVIS_VERSION=1.4.5
ADMIN_LOGIN=admin
ADMIN_PASSWORD=admin
AUTH_REALM=SabreDAV
AUTH_METHOD=Digest
CALDAV_ENABLED=true
@ -22,10 +21,8 @@ WEBDAV_ENABLED=false
TMP_DIR='/tmp'
PUBLIC_DIR='/public'
HOSTNAME=dav.mydomain.tld
INVITE_FROM_ADDRESS=no-reply@example.org
EMAIL=no-reply@mydomain.tld
MAIL_HOST=smtp.myprovider.com
MAIL_PORT=587
MAIL_USERNAME=userdav
MAIL_PASSWORD=test
MAIL_PASSWORD=test

View File

@ -5,7 +5,6 @@ services:
nginx:
image: nginx:1.17.5-alpine
container_name: nginx
env_file: .env
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
depends_on:
- davis
@ -20,17 +19,34 @@ services:
mysql:
image: mariadb:10.4.10
container_name: mysql
env_file: .env
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
davis:
build:
context: ./
dockerfile: ./Dockerfile
args:
version: "1.4.5"
image: davis:1.4.5
version: ${DAVIS_VERSION}
image: davis:${DAVIS_VERSION}
container_name: davis
env_file: .env
environment:
- APP_ENV=prod
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
- MAILER_URL=smtp://${MAIL_HOST}:${MAIL_PORT}?username=${MAIL_USERNAME}&password=${MAIL_PASSWORD}
- ADMIN_LOGIN=${ADMIN_LOGIN}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
- AUTH_REALM=${AUTH_REALM}
- AUTH_METHOD=${AUTH_METHOD}
- CALDAV_ENABLED=${CALDAV_ENABLED}
- CARDDAV_ENABLED=${CARDDAV_ENABLED}
- WEBDAV_ENABLED=${WEBDAV_ENABLED}
- TMP_DIR=${TMP_DIR}
- PUBLIC_DIR=${PUBLIC_DIR}
- INVITE_FROM_ADDRESS=${INVITE_FROM_ADDRESS}
depends_on:
- mysql
volumes:
@ -38,4 +54,4 @@ services:
volumes:
davis_www:
name: davis_www
name: davis_www