wordpress works now with :

+ volumes in mariadb container
+ db pswd in quotes
+ somes other settings
This commit is contained in:
hugo gogo
2022-09-21 18:10:03 +02:00
parent ef8ce69dad
commit 0603616d3e
9 changed files with 108 additions and 81 deletions

View File

@@ -30,6 +30,7 @@
# common -----------------------------------------------------
ARG DB_HOST
ARG DB_NAME
ARG DB_USER
ARG DB_PSWD
@@ -41,9 +42,10 @@ RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql && \
# configure wp database
COPY ./conf/create_db.sql /usr/bin/create_db.sql
RUN sed -i "s/\${DB_NAME}/${DB_NAME}/g" /usr/bin/create_db.sql
RUN sed -i "s/\${DB_USER}/${DB_USER}/g" /usr/bin/create_db.sql
RUN sed -i "s/\${DB_PSWD}/${DB_PSWD}/g" /usr/bin/create_db.sql
RUN sed -i "s/\${DB_HOST}/${DB_HOST}/g" /usr/bin/create_db.sql && \
sed -i "s/\${DB_NAME}/${DB_NAME}/g" /usr/bin/create_db.sql && \
sed -i "s/\${DB_USER}/${DB_USER}/g" /usr/bin/create_db.sql && \
sed -i "s/\${DB_PSWD}/${DB_PSWD}/g" /usr/bin/create_db.sql
ENTRYPOINT [ "mysqld", "--user=mysql", "--init-file=/usr/bin/create_db.sql" ]

View File

@@ -1,5 +1,5 @@
USE mysql;
CREATE DATABASE IF NOT EXISTS ${DB_NAME};
CREATE USER IF NOT EXISTS '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PSWD}';
GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_USER}'@'localhost' with grant option;
CREATE USER IF NOT EXISTS '${DB_USER}'@'%' IDENTIFIED BY '${DB_PSWD}';
GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_USER}'@'%' with grant option;