Skip to content

Commit

Permalink
left only WP conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
amine-za committed Jul 1, 2024
1 parent d8cad4c commit c9b6086
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 10 deletions.
1 change: 1 addition & 0 deletions srcs/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ DB_NAME=wordpress
DB_ROOT=rootpass
DB_USER=wpuser
DB_PASS=wppass
DB_HOST=mariadb:3306
43 changes: 33 additions & 10 deletions srcs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
version: '3'

services:

nginx:
build:
context: .
dockerfile: requirements/nginx/Dockerfile
container_name: nginx
depends_on:
- wordpress
ports:
- "443:443"
volumes:
- /home/${USER}/simple_docker_nginx_html/public/html:/var/www/
networks:
- my_network
restart: always

mariadb:
build:
context: .
dockerfile: requirements/mariadb/Dockerfile
container_name: mariadb
env_file: .env
container_name: mariadb
ports:
- "3306:3306"
networks:
- my_network
restart: always

nginx:
wordpress:
build:
context: .
dockerfile: requirements/nginx/Dockerfile
container_name: nginx
#depends_on:
# - wordpress
ports:
- "443:443"
volumes:
- /home/${USER}/simple_docker_nginx_html/public/html:/var/www/
dockerfile: requirements/wordpress/Dockerfile
env_file: .env
container_name: wordpress
depends_on:
- mariadb
restart: always
volumes:
- /home/${USER}/simple_docker_nginx_html/public/html:/var/www/
# - wp-volume:/var/www/
networks:
- my_network


networks:
my_network:
driver: bridge
39 changes: 39 additions & 0 deletions srcs/requirements/wordpress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,41 @@
FROM alpine:3.18

RUN apk update && apk upgrade && apk add --no-cache php82 php82-fpm php82-mysqli php82-json php82-curl \
php82-dom php82-exif php82-fileinfo php82-mbstring php82-openssl php82-xml php82-zip wget unzip

# FPM: FastCGI Process Manager.
# MYSQLI: A php extension for interactiong with MYSQL database in a secure way,
# connect to database, fetch and insert data...
# JSON: Json data format cmnly used for exchanging inf btwn apps, widly usd for APIs.
# php-curl: php-curl is all about enabling your PHP scripts to make requests to
# other servers and services over the internet using http and other prtcls.
# php-dom: -
# php-exif: -
# php-fileinfo: Provides functionality to determine file types and properties.
# php-mbstring: Enables multi-byte string handling for character sets beyond basic ASCII.
# php-openssl: Offers secure communication capabilities using SSL and TLS.
# php-xml: -
# php-zip: Allows you to create and work with ZIP archives in your PHP code.
# wget: A command-line tool for downloading files from the internet.
# unzip: A command-line tool for extracting ZIP archives.

RUN sed -i "s|listen = 127.0.0.1:9000|listen = 9000|g" /etc/php82/php-fpm.d/www.conf && \
sed -i "s|;listen.owner = nobody|listen.owner = nobody|g" /etc/php82/php-fpm.d/www.conf && \
sed -i "s|;listen.group = nobody|listen.group = nobody|g" /etc/php82/php-fpm.d/www.conf && \
rm -f /var/cache/apk/*

WORKDIR /tmp

RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
mv wp-cli.phar /usr/local/bin/wp

WORKDIR /var/www

COPY requirements/wordpress/conf/wp-config-create.sh .

RUN sh wp-config-create.sh && \
rm wp-config-create.sh && \
chmod -R 777 wp-content/

CMD ["/usr/sbin/php-fpm82", "-F"]
9 changes: 9 additions & 0 deletions srcs/requirements/wordpress/conf/wp-config-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo "wp-config-create.sh >>>";

wp core download --allow-root

wp config create --allow-root --dbname=${DB_NAME} --dbuser=${DB_USER} --dbpass=${DB_PASS} --dbhost=${DB_HOST}

wp core install --allow-root --url=${WP_URL} --title=${WP_TITLE} --admin_user=${WP_ADMIN} --admin_password=${WP_ADMIN_PASSWD} --admin_email=${WP_ADMIN_EMAIL}

wp user create ${WP_USER} ${WP_USER_EMAIL} --role=editor --user_pass=${WP_PASSWD} --path=/var/www/html/wordpress --allow-root
9 changes: 9 additions & 0 deletions srcs/requirements/wordpress/tools/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash



# if [! -d "/home/${USER}/data" ]; then
# mkdir ~/data
# mkdir ~/data/mariadb
# mkdir ~/data/wordpress
# fi

0 comments on commit c9b6086

Please sign in to comment.