Compare commits
6 Commits
231807c918
...
main
Author | SHA1 | Date | |
---|---|---|---|
193c18c47a | |||
0b52e973e3 | |||
78b202c264 | |||
1d5eb6c1b6 | |||
ed3195f536 | |||
71dc294248 |
5
Makefile
5
Makefile
@ -1,13 +1,16 @@
|
||||
all: up
|
||||
|
||||
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
|
||||
|
||||
fclean:
|
||||
-docker rm -f `docker ps -aq`
|
||||
-docker volume rm -f `docker volume ls -q`
|
||||
-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
|
||||
rm -rf /home/cchauvet/data/wp-files /home/cchauvet/data/wp-db
|
||||
|
||||
up: run
|
||||
|
@ -1,17 +1,62 @@
|
||||
version: "3"
|
||||
services:
|
||||
nginx:
|
||||
container_name: nginx
|
||||
image: nginx
|
||||
build: nginx
|
||||
ports:
|
||||
- "443:443"
|
||||
volumes:
|
||||
- wordpress:/var/www/wordpress
|
||||
depends_on:
|
||||
- wordpress
|
||||
networks:
|
||||
- inception
|
||||
restart: always
|
||||
|
||||
wordpress:
|
||||
container_name: wordpress
|
||||
image: wordpress
|
||||
build: wordpress
|
||||
volumes:
|
||||
- wordpress:/var/www/wordpress
|
||||
depends_on:
|
||||
- mariadb
|
||||
env_file:
|
||||
- .env
|
||||
networks:
|
||||
- inception
|
||||
restart: always
|
||||
|
||||
mariadb:
|
||||
container_name: mariadb
|
||||
image: mariadb
|
||||
build: mariadb
|
||||
volumes:
|
||||
- mariadb:/data
|
||||
env_file:
|
||||
- .env
|
||||
networks:
|
||||
- inception
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
|
||||
wordpress:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: 'none'
|
||||
o: 'bind'
|
||||
device: '/home/cchauvet/data/wp-files/'
|
||||
|
||||
mariadb:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: 'none'
|
||||
o: 'bind'
|
||||
device: '/home/cchauvet/data/wp-db/'
|
||||
|
||||
|
||||
networks:
|
||||
inception:
|
||||
driver: bridge
|
||||
|
10
srcs/mariadb/Dockerfile
Normal file
10
srcs/mariadb/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM alpine:3.17
|
||||
|
||||
RUN apk update
|
||||
|
||||
RUN apk add mariadb
|
||||
RUN mariadb-install-db
|
||||
RUN mkdir /run/mysqld
|
||||
COPY init.sql entrypoint.sh /etc/
|
||||
|
||||
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
|
2
srcs/mariadb/init.sql
Normal file
2
srcs/mariadb/init.sql
Normal file
@ -0,0 +1,2 @@
|
||||
CREATE DATABASE wordpress;
|
||||
GRANT ALL PRIVILEGES ON wordpress.* TO 'DB_USER'@'%' IDENTIFIED BY 'DB_PASS';
|
@ -10,7 +10,7 @@ server {
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
|
@ -2,7 +2,7 @@ FROM alpine:3.17
|
||||
|
||||
RUN apk update
|
||||
|
||||
RUN apk add mysql-client php php-fpm php-mysqli
|
||||
RUN apk add php php-phar php-fpm php-mysqli php-iconv mysql-client php-json php-curl php-dom php-exif php-fileinfo php-mbstring php-openssl php-xml php-zip php-tokenizer php-session
|
||||
|
||||
RUN mkdir -p /var/www/
|
||||
WORKDIR /var/www/
|
||||
@ -12,4 +12,11 @@ RUN rm latest.tar.gz
|
||||
|
||||
RUN sed -i "s/^listen.*/listen = 9000/" /etc/php81/php-fpm.d/www.conf
|
||||
|
||||
ENTRYPOINT ["php-fpm81", "-F"]
|
||||
WORKDIR wordpress
|
||||
RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
RUN chmod +x wp-cli.phar
|
||||
RUN mv wp-cli.phar /usr/local/bin/wp
|
||||
|
||||
COPY entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
||||
|
7
srcs/wordpress/entrypoint.sh
Normal file
7
srcs/wordpress/entrypoint.sh
Normal file
@ -0,0 +1,7 @@
|
||||
wp config create --dbname=wordpress --dbuser=$DB_USER --dbpass=$DB_PASS --dbhost=mariadb
|
||||
|
||||
wp core install --url=cchauvet.42.fr --title=BOZOLAND --admin_user=$WP_ADMIN_USER --admin_password=$WP_ADMIN_PASS --admin_email=$WP_ADMIN_USER@email.com
|
||||
|
||||
wp user create $WP_USER $WP_USER@email.com --user_pass=$WP_PASS
|
||||
|
||||
exec php-fpm81 -F
|
Reference in New Issue
Block a user