add: mariadb docker, wordpress now works :))))
This commit is contained in:
parent
b7cb3733ec
commit
49a136c709
9 changed files with 185 additions and 2 deletions
22
srcs/requirements/mariadb/Dockerfile
Normal file
22
srcs/requirements/mariadb/Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# TODO(any)(latest)
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk update
|
||||
RUN apk add mariadb
|
||||
RUN apk fix
|
||||
|
||||
RUN rm -rf /etc/my.cnf.d/
|
||||
RUN mkdir -p /etc/my.cnf.d/
|
||||
COPY conf/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf
|
||||
COPY run.sh /run.sh
|
||||
|
||||
# TODO(secret)
|
||||
RUN addgroup -S www && adduser -S www www
|
||||
RUN mkdir /db
|
||||
RUN chmod -R 666 /db
|
||||
|
||||
EXPOSE 3306
|
||||
|
||||
# start
|
||||
CMD ["/run.sh"]
|
||||
#CMD ["ls", "-AlF", "/"]
|
||||
10
srcs/requirements/mariadb/conf/mariadb-server.cnf
Normal file
10
srcs/requirements/mariadb/conf/mariadb-server.cnf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[client-server]
|
||||
socket=/tmp/mysql.sock
|
||||
port=3306
|
||||
|
||||
[mysqld]
|
||||
# fix from https://stackoverflow.com/questions/75696472/aborted-connection-3-to-db-unconnected-user-unauthenticated-host-172-21
|
||||
skip-grant-tables
|
||||
|
||||
[mariadb]
|
||||
datadir=/db
|
||||
34
srcs/requirements/mariadb/run.sh
Executable file
34
srcs/requirements/mariadb/run.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo
|
||||
|
||||
dirisempty()
|
||||
{
|
||||
[ -z "$( ls -A "$1" )" ]
|
||||
}
|
||||
|
||||
# install database if doesn't exist
|
||||
if dirisempty /db
|
||||
then
|
||||
echo "database doesn't exist. creating it..."
|
||||
echo
|
||||
chmod -R 777 /db
|
||||
mariadb-install-db --user=www --datadir=/db
|
||||
# TODO(secret)
|
||||
echo '
|
||||
FLUSH PRIVILEGES;
|
||||
CREATE DATABASE wp;
|
||||
GRANT ALL PRIVILEGES ON wp.* TO wwsw IDENTIFIED BY "ultraPassword";
|
||||
FLUSH PRIVILEGES;
|
||||
' | mariadbd -u root --bootstrap
|
||||
echo
|
||||
echo "database created!"
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "to recreate a new database, remove the db volume of this compose."
|
||||
echo
|
||||
|
||||
# run mariadb
|
||||
mariadbd -u root
|
||||
Loading…
Add table
Add a link
Reference in a new issue