upgrade makefile, add env var to mariadb
This commit is contained in:
parent
0b52e973e3
commit
193c18c47a
5
Makefile
5
Makefile
@ -1,13 +1,16 @@
|
|||||||
all: up
|
all: up
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
@mkdir -p /home/cchauvet/data/wp-files
|
||||||
|
@mkdir -p /home/cchauvet/data/wp-db
|
||||||
docker-compose -f srcs/docker-compose.yml up --build -d
|
docker-compose -f srcs/docker-compose.yml up --build -d
|
||||||
|
|
||||||
fclean:
|
fclean:
|
||||||
-docker rm -f `docker ps -aq`
|
-docker rm -f `docker ps -aq`
|
||||||
-docker volume rm -f `docker volume ls -q`
|
-docker volume rm -f `docker volume ls -q`
|
||||||
-docker image rm -f `docker image ls -aq`
|
-docker image rm -f `docker image ls -aq`
|
||||||
-docker network rm -f `docker network ls -q`
|
-docker network rm `docker network ls -q`
|
||||||
-docker builder prune --all --force
|
-docker builder prune --all --force
|
||||||
|
rm -rf /home/cchauvet/data/wp-files /home/cchauvet/data/wp-db
|
||||||
|
|
||||||
up: run
|
up: run
|
||||||
|
@ -12,6 +12,7 @@ services:
|
|||||||
- wordpress
|
- wordpress
|
||||||
networks:
|
networks:
|
||||||
- inception
|
- inception
|
||||||
|
restart: always
|
||||||
|
|
||||||
wordpress:
|
wordpress:
|
||||||
container_name: wordpress
|
container_name: wordpress
|
||||||
@ -25,6 +26,7 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
networks:
|
networks:
|
||||||
- inception
|
- inception
|
||||||
|
restart: always
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
container_name: mariadb
|
container_name: mariadb
|
||||||
@ -36,6 +38,7 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
networks:
|
networks:
|
||||||
- inception
|
- inception
|
||||||
|
restart: always
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|
||||||
|
@ -5,6 +5,6 @@ RUN apk update
|
|||||||
RUN apk add mariadb
|
RUN apk add mariadb
|
||||||
RUN mariadb-install-db
|
RUN mariadb-install-db
|
||||||
RUN mkdir /run/mysqld
|
RUN mkdir /run/mysqld
|
||||||
COPY init.sql /etc
|
COPY init.sql entrypoint.sh /etc/
|
||||||
|
|
||||||
ENTRYPOINT ["mariadbd", "--no-defaults", "--user=root", "--datadir=/data", "--init-file=/etc/init.sql"]
|
ENTRYPOINT ["sh", "/etc/entrypoint.sh"]
|
||||||
|
6
srcs/mariadb/entrypoint.sh
Normal file
6
srcs/mariadb/entrypoint.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
sed -i "s/DB_USER/$DB_USER/g" /etc/init.sql
|
||||||
|
sed -i "s/DB_PASS/$DB_PASS/g" /etc/init.sql
|
||||||
|
|
||||||
|
cat /etc/init.sql >/dev/stderr
|
||||||
|
|
||||||
|
exec mariadbd --no-defaults --user=root --datadir=/data --init-file=/etc/init.sql
|
@ -1,2 +1,2 @@
|
|||||||
CREATE DATABASE wordpress;
|
CREATE DATABASE wordpress;
|
||||||
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%' IDENTIFIED BY 'wordpress';
|
GRANT ALL PRIVILEGES ON wordpress.* TO 'DB_USER'@'%' IDENTIFIED BY 'DB_PASS';
|
||||||
|
Loading…
Reference in New Issue
Block a user