small changes in volume gestion for db

This commit is contained in:
asus
2024-02-06 18:34:25 +01:00
parent 24aac70ac8
commit bb844a428b
3 changed files with 5 additions and 5 deletions

View File

@@ -46,6 +46,7 @@ services:
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PSWD=${DB_PSWD}
- DB_VOLUME_DIR=${DB_VOLUME_DIR}
healthcheck:
test: mariadb -h ${DB_HOST} -u ${DB_USER} -p"${DB_PSWD}" -e exit 2> /dev/null
interval: 1s
@@ -76,6 +77,7 @@ services:
condition: service_healthy
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
# local driver options : https://stackoverflow.com/questions/62232676/docker-local-volume-driver-options
volumes:
db_volume:
driver: local

View File

@@ -16,9 +16,11 @@ ARG DB_HOST
ARG DB_NAME
ARG DB_USER
ARG DB_PSWD
ARG DB_VOLUME_DIR
# init mysql database
RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql && \
# https://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html
RUN mysql_install_db --user=mysql --datadir=${DB_VOLUME_DIR} && \
mkdir -p /var/run/mysqld && \
chown -R mysql:root /var/run/mysqld