small changes in volume gestion for db
This commit is contained in:
4
Makefile
4
Makefile
@@ -89,11 +89,7 @@ build_logs:
|
||||
|
||||
|
||||
|
||||
# before starting the containers with up,
|
||||
# creating a README.md file inside some binded volumes dir
|
||||
# to avoid them having their ownership overwritten by docker
|
||||
up:
|
||||
echo "this is a binded docker volume for plugins" >> ${VOLUME_PLUGINS_D}/README.md
|
||||
docker compose -f $(COMPOSE_FILE) up -d
|
||||
@echo $(B_PURPLE)"you can now connect at "$(B_YELLOW)"https://$(WP_COMPLETE_URL)"$(B_PURPLE)" or 127.0.0.1"$(RESET)
|
||||
down:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user