there is a map with a marker, and the docker don't generate a new certificate all the time
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -49,3 +49,5 @@ Thumbs.db
|
|||||||
*.wmv
|
*.wmv
|
||||||
*.iso
|
*.iso
|
||||||
|
|
||||||
|
# ssl certificates
|
||||||
|
ssl/
|
||||||
|
|||||||
19
Makefile
19
Makefile
@@ -24,9 +24,10 @@ RESET = "\e[0m"
|
|||||||
|
|
||||||
COMPOSE = ./srcs/docker-compose.yml
|
COMPOSE = ./srcs/docker-compose.yml
|
||||||
|
|
||||||
VOLUME_PATH = $(shell grep -w "MAP_VOLUMES" ./srcs/.env | cut -d "=" -f 2)
|
VOLUMES_D = $(shell grep "^HOST_VOLUME" ./srcs/.env | cut -d "=" -f 2)
|
||||||
VOLUMES_D = $(VOLUME_PATH)/wp_volume \
|
#VOLUME_PATH = $(shell grep "^HOST_VOLUME" ./srcs/.env | cut -d "=" -f 2)
|
||||||
$(VOLUME_PATH)/db_volume
|
#VOLUMES_D = $(VOLUME_PATH)/wp_volume \
|
||||||
|
# $(VOLUME_PATH)/db_volume
|
||||||
WP_URL = $(shell grep "WP_URL" ./srcs/.env | cut -d "=" -f 2)
|
WP_URL = $(shell grep "WP_URL" ./srcs/.env | cut -d "=" -f 2)
|
||||||
|
|
||||||
# list of running containers, see : https://stackoverflow.com/questions/10024279/how-to-use-shell-commands-in-makefile
|
# list of running containers, see : https://stackoverflow.com/questions/10024279/how-to-use-shell-commands-in-makefile
|
||||||
@@ -37,18 +38,18 @@ VOLUMES = $(shell docker volume ls -q)
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
all: build up
|
all: volumes build up
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mkdir -p $(VOLUMES_D)
|
mkdir -p $(VOLUMES_D)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
- if ! grep "127.0.0.1 ${WP_URL}" /etc/hosts 2> /dev/null; then \
|
- if ! grep "127.0.0.1 $(WP_URL)" /etc/hosts 2> /dev/null; then \
|
||||||
bash -c 'echo -e "\n# adding for inception (you can delete it)\n127.0.0.1 $(WP_URL)" >> /etc/hosts'; \
|
bash -c 'echo -e "\n# adding for inception (you can delete it)\n127.0.0.1 $(WP_URL)" >> /etc/hosts'; \
|
||||||
fi
|
fi
|
||||||
docker-compose -f $(COMPOSE) build
|
docker-compose -f $(COMPOSE) build
|
||||||
|
|
||||||
up: volumes
|
up:
|
||||||
docker-compose -f $(COMPOSE) up -d
|
docker-compose -f $(COMPOSE) up -d
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@@ -86,8 +87,8 @@ re: fclean all
|
|||||||
|
|
||||||
# !! remove everything everything
|
# !! remove everything everything
|
||||||
erase_v:
|
erase_v:
|
||||||
- rm -rf ${VOLUMES_D}
|
- rm -rf $(VOLUMES_D)
|
||||||
hard: erase_v re
|
new: erase_v re
|
||||||
|
|
||||||
.PHONY : all $(VOLUMES_D) build up list clean fclean re
|
.PHONY : all $(VOLUMES_D) build up list clean fclean re erase_v new
|
||||||
|
|
||||||
|
|||||||
17
srcs/.env
17
srcs/.env
@@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
# NGINX SETUP
|
||||||
|
|
||||||
|
NG_VOLUME_CERTS=/etc/ssl
|
||||||
|
|
||||||
# MARIADB SETUP
|
# MARIADB SETUP
|
||||||
|
|
||||||
DB_HOST=mariadb
|
DB_HOST=mariadb
|
||||||
@@ -9,8 +13,8 @@ DB_PSWD="too bad you have read this now i have to erase your memory"
|
|||||||
# WORDPRESS SETUP
|
# WORDPRESS SETUP
|
||||||
|
|
||||||
WP_URL=local_lejourduprof.com
|
WP_URL=local_lejourduprof.com
|
||||||
WP_DIR=/var/www/html
|
WP_VOLUME_DIR=/var/www/html
|
||||||
WP_PLUGIN_DIR=/home/www-data/
|
WP_VOLUME_PLUGINS=/home/www-data
|
||||||
WP_TITLE=title
|
WP_TITLE=title
|
||||||
|
|
||||||
WP_ADMIN=hulamy
|
WP_ADMIN=hulamy
|
||||||
@@ -25,6 +29,11 @@ WP_USER_EMAIL=moehu36@42.fr
|
|||||||
|
|
||||||
MAX_UPLOAD_SIZE=512
|
MAX_UPLOAD_SIZE=512
|
||||||
EXECUTION_TIME=300
|
EXECUTION_TIME=300
|
||||||
MAP_VOLUMES=/home/lenovo/data/lejourduprof
|
|
||||||
MAP_VOLUMES_PLUGINS=/home/lenovo/42/lejourduprof/srcs/plugins
|
# HOST (start with "HOST_VOLUME" for makefile)
|
||||||
|
|
||||||
|
HOST_VOLUME_WP=/home/lenovo/data/lejourduprof/wp_volume
|
||||||
|
HOST_VOLUME_DB=/home/lenovo/data/lejourduprof/db_volume
|
||||||
|
HOST_VOLUME_PLUGINS=/home/lenovo/42/lejourduprof/srcs/plugins
|
||||||
|
HOST_VOLUME_CERTS=/home/lenovo/42/lejourduprof/srcs/requirements/nginx/conf/ssl
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,18 @@ services:
|
|||||||
- inception
|
- inception
|
||||||
ports:
|
ports:
|
||||||
- "443:443"
|
- "443:443"
|
||||||
#- "80:80"
|
|
||||||
volumes:
|
volumes:
|
||||||
- wp_volume:${WP_DIR}
|
- wp_volume:${WP_VOLUME_DIR}
|
||||||
- wp_plugins:${WP_PLUGIN_DIR}
|
- wp_plugins:${WP_VOLUME_PLUGINS}
|
||||||
|
- ng_certs:${NG_VOLUME_CERTS}
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
args:
|
args:
|
||||||
- WP_URL=${WP_URL}
|
- WP_URL=${WP_URL}
|
||||||
- MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE}
|
- MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE}
|
||||||
|
- WP_VOLUME_DIR=${WP_VOLUME_DIR}
|
||||||
|
- WP_VOLUME_PLUGINS=${WP_VOLUME_PLUGINS}
|
||||||
|
- NG_VOLUME_CERTS=${NG_VOLUME_CERTS}
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: nginx_container
|
container_name: nginx_container
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -65,12 +68,13 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- inception
|
- inception
|
||||||
volumes:
|
volumes:
|
||||||
- wp_volume:${WP_DIR}
|
- wp_volume:${WP_VOLUME_DIR}
|
||||||
- wp_plugins:${WP_PLUGIN_DIR}
|
- wp_plugins:${WP_VOLUME_PLUGINS}
|
||||||
build:
|
build:
|
||||||
context: ./requirements/wordpress
|
context: ./requirements/wordpress
|
||||||
args:
|
args:
|
||||||
- WP_DIR=${WP_DIR}
|
- WP_VOLUME_DIR=${WP_VOLUME_DIR}
|
||||||
|
- WP_VOLUME_PLUGINS=${WP_VOLUME_PLUGINS}
|
||||||
- MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE}
|
- MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE}
|
||||||
- EXECUTION_TIME=${EXECUTION_TIME}
|
- EXECUTION_TIME=${EXECUTION_TIME}
|
||||||
image: wordpress
|
image: wordpress
|
||||||
@@ -81,24 +85,30 @@ services:
|
|||||||
|
|
||||||
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
|
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
|
||||||
volumes:
|
volumes:
|
||||||
wp_volume:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
o: "bind"
|
|
||||||
device: ${MAP_VOLUMES}/wp_volume
|
|
||||||
wp_plugins:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
o: "bind"
|
|
||||||
device: ${MAP_VOLUMES_PLUGINS}
|
|
||||||
db_volume:
|
db_volume:
|
||||||
driver: local
|
driver: local
|
||||||
driver_opts:
|
driver_opts:
|
||||||
type: none
|
type: none
|
||||||
o: "bind"
|
o: "bind"
|
||||||
device: ${MAP_VOLUMES}/db_volume
|
device: ${HOST_VOLUME_DB}
|
||||||
|
wp_volume:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: ${HOST_VOLUME_WP}
|
||||||
|
wp_plugins:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: ${HOST_VOLUME_PLUGINS}
|
||||||
|
ng_certs:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: ${HOST_VOLUME_CERTS}
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
inception:
|
inception:
|
||||||
|
|||||||
1
srcs/plugins/google_map/google_map
Symbolic link
1
srcs/plugins/google_map/google_map
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/www-data//google_map
|
||||||
@@ -56,6 +56,7 @@ function my_init_script() {
|
|||||||
wp_enqueue_script('my_script', $script_path, array('jquery'));
|
wp_enqueue_script('my_script', $script_path, array('jquery'));
|
||||||
$style_path = plugins_url('style.css', __FILE__);
|
$style_path = plugins_url('style.css', __FILE__);
|
||||||
wp_enqueue_style('my_style', $style_path);
|
wp_enqueue_style('my_style', $style_path);
|
||||||
|
console_log("urlencode : " . urlencode("128 rue de la croix nivert, paris"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_google_map() {
|
function show_google_map() {
|
||||||
@@ -65,7 +66,7 @@ function show_google_map() {
|
|||||||
$GoogleMap_zoom = get_option('map_zoom_value');
|
$GoogleMap_zoom = get_option('map_zoom_value');
|
||||||
//src="https://maps.googleapis.com/maps/api/geocode/json?address=paris&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE
|
//src="https://maps.googleapis.com/maps/api/geocode/json?address=paris&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE
|
||||||
?>
|
?>
|
||||||
<script async defer
|
<script
|
||||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
src="http://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||||
</script>
|
</script>
|
||||||
<div class="latitude"><?php echo $GoogleMap_Latitude; ?></div>
|
<div class="latitude"><?php echo $GoogleMap_Latitude; ?></div>
|
||||||
|
|||||||
1
srcs/plugins/map_prof/map_prof
Symbolic link
1
srcs/plugins/map_prof/map_prof
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/www-data//map_prof
|
||||||
31
srcs/plugins/map_prof/map_prof.php
Executable file → Normal file
31
srcs/plugins/map_prof/map_prof.php
Executable file → Normal file
@@ -1,8 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @package map_prof
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
Plugin Name: map_prof
|
Plugin Name: map_prof
|
||||||
Plugin URI:
|
Plugin URI:
|
||||||
@@ -12,6 +8,12 @@ Version: 1.0.0
|
|||||||
Author URI:
|
Author URI:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
add_action( 'init', 'my_init_script' );
|
||||||
|
function my_init_script() {
|
||||||
|
$style_path = plugins_url('style.css', __FILE__);
|
||||||
|
wp_enqueue_style('my_style', $style_path);
|
||||||
|
}
|
||||||
|
|
||||||
// if bock theme : https://wordpress.org/support/topic/twenty-twenty-two-cpt-template-error-theme-without-header-is-deprecated/
|
// if bock theme : https://wordpress.org/support/topic/twenty-twenty-two-cpt-template-error-theme-without-header-is-deprecated/
|
||||||
function add_map_api(){
|
function add_map_api(){
|
||||||
?>
|
?>
|
||||||
@@ -43,7 +45,7 @@ function print_content($content){
|
|||||||
|
|
||||||
// print only on the page 'map', and other conditions
|
// print only on the page 'map', and other conditions
|
||||||
// https://developer.wordpress.org/reference/hooks/the_content/
|
// https://developer.wordpress.org/reference/hooks/the_content/
|
||||||
if (!( is_page('map') && in_the_loop() && is_main_query() ))
|
if (!( is_page('map_prof') && in_the_loop() && is_main_query() ))
|
||||||
return $content;
|
return $content;
|
||||||
|
|
||||||
// https://developer.wordpress.org/reference/functions/get_posts/
|
// https://developer.wordpress.org/reference/functions/get_posts/
|
||||||
@@ -90,9 +92,24 @@ function print_content($content){
|
|||||||
// $content .= "</p>";
|
// $content .= "</p>";
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//$content .= "<div id='map'><p>OSM map 2</p></div>";
|
$content .= '<div id="map"></div>';
|
||||||
|
$content .= '<script>
|
||||||
|
function initMap() {
|
||||||
|
var location = {lat: 38.8833, lng: -77.0167};
|
||||||
|
var map = new google.maps.Map(document.getElementById("map"), {
|
||||||
|
zoom: 12,
|
||||||
|
center: location
|
||||||
|
});
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: location,
|
||||||
|
map: map
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>';
|
||||||
|
$content .= '<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE&callback=initMap"></script>';
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
};
|
};
|
||||||
//add_action('the_content', 'print_content', 1);
|
add_action('the_content', 'print_content', 1);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
4
srcs/plugins/map_prof/style.css
Normal file
4
srcs/plugins/map_prof/style.css
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#map {
|
||||||
|
height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -1,34 +1,16 @@
|
|||||||
# debian -----------------------------------------------------
|
|
||||||
|
|
||||||
# FROM debian:buster
|
FROM alpine:3.15
|
||||||
#
|
|
||||||
# # vim and bash for debug
|
|
||||||
# RUN apt update && apt install -y \
|
|
||||||
# mariadb-client \
|
|
||||||
# mariadb-server \
|
|
||||||
# vim bash \
|
|
||||||
# && \
|
|
||||||
# rm -rf /var/lib/apt/lists/*
|
|
||||||
#
|
|
||||||
# # config file .cnf :
|
|
||||||
# COPY ./conf/50-server.cnf.debian /etc/mysql/mariadb.conf.d/50-server.cnf
|
|
||||||
|
|
||||||
# alpine -----------------------------------------------------
|
# vim and bash for debug
|
||||||
|
RUN apk update && apk add \
|
||||||
|
mariadb \
|
||||||
|
mariadb-client \
|
||||||
|
vim bash \
|
||||||
|
&& \
|
||||||
|
rm -rf /var/cache/apk*
|
||||||
|
|
||||||
FROM alpine:3.15
|
# config file .cnf :
|
||||||
|
COPY ./conf/mariadb-server.cnf.alpine /etc/my.cnf.d/mariadb-server.cnf
|
||||||
# vim and bash for debug
|
|
||||||
RUN apk update && apk add \
|
|
||||||
mariadb \
|
|
||||||
mariadb-client \
|
|
||||||
vim bash \
|
|
||||||
&& \
|
|
||||||
rm -rf /var/cache/apk*
|
|
||||||
|
|
||||||
# config file .cnf :
|
|
||||||
COPY ./conf/mariadb-server.cnf.alpine /etc/my.cnf.d/mariadb-server.cnf
|
|
||||||
|
|
||||||
# common -----------------------------------------------------
|
|
||||||
|
|
||||||
ARG DB_HOST
|
ARG DB_HOST
|
||||||
ARG DB_NAME
|
ARG DB_NAME
|
||||||
|
|||||||
@@ -16,10 +16,15 @@ COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
|
|||||||
RUN adduser -S www-data && \
|
RUN adduser -S www-data && \
|
||||||
adduser www-data www-data
|
adduser www-data www-data
|
||||||
|
|
||||||
RUN mkdir -p /var/www/html
|
|
||||||
|
|
||||||
ARG WP_URL
|
ARG WP_URL
|
||||||
ARG MAX_UPLOAD_SIZE
|
ARG MAX_UPLOAD_SIZE
|
||||||
|
ARG WP_VOLUME_DIR
|
||||||
|
ARG WP_VOLUME_PLUGINS
|
||||||
|
ARG NG_VOLUME_CERTS
|
||||||
|
|
||||||
|
# create and empty volumes dir
|
||||||
|
RUN mkdir -p ${WP_VOLUME_DIR} ${WP_VOLUME_PLUGINS} ${NG_VOLUME_CERTS} && \
|
||||||
|
rm -rf ${WP_VOLUME_DIR}/* ${WP_VOLUME_PLUGINS}/* ${NG_VOLUME_CERTS}/*
|
||||||
|
|
||||||
# replace WP_URL
|
# replace WP_URL
|
||||||
RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
|
RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
|
||||||
@@ -27,18 +32,15 @@ RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
|
|||||||
# replace max file size upload
|
# replace max file size upload
|
||||||
RUN sed -i "s/\(client_max_body_size \).*\(m;\)/\1${MAX_UPLOAD_SIZE}\2/g" /etc/nginx/nginx.conf
|
RUN sed -i "s/\(client_max_body_size \).*\(m;\)/\1${MAX_UPLOAD_SIZE}\2/g" /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# empty /var/www/html folder to avoid it to rewrite volume
|
|
||||||
#RUN rm -rf /var/www/html/*
|
|
||||||
|
|
||||||
# personalized index.html
|
|
||||||
COPY ./conf/index.html /data/www/
|
|
||||||
|
|
||||||
# create ssl certificate
|
# create ssl certificate
|
||||||
RUN mkdir -p /etc/ssl/private /etc/ssl/certs
|
COPY ./conf/ssl ${NG_VOLUME_CERTS}
|
||||||
RUN openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
|
RUN if [ -z "$(ls -A ${NG_VOLUME_CERTS} 2>/dev/null)" ]; then \
|
||||||
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=${WP_URL}" \
|
mkdir ${NG_VOLUME_CERTS}/private ${NG_VOLUME_CERTS}/certs; \
|
||||||
-keyout /etc/ssl/private/${WP_URL}.key \
|
openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
|
||||||
-out /etc/ssl/certs/${WP_URL}.crt
|
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=${WP_URL}" \
|
||||||
|
-keyout ${NG_VOLUME_CERTS}/private/${WP_URL}.key \
|
||||||
|
-out ${NG_VOLUME_CERTS}/certs/${WP_URL}.crt; \
|
||||||
|
fi
|
||||||
|
|
||||||
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
|
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
# doc : https://nginx.org/en/docs/dirindex.html
|
# doc : https://nginx.org/en/docs/dirindex.html
|
||||||
|
|
||||||
# WIP redirect http to https
|
|
||||||
#server {
|
|
||||||
# listen 80;
|
|
||||||
# listen [::]:80;
|
|
||||||
# server_name _;
|
|
||||||
# return 301 https://$host$request_uri;
|
|
||||||
#}
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||||
listen [::]:443 ssl; # for ipv6
|
listen [::]:443 ssl; # for ipv6
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
hello world !
|
|
||||||
@@ -18,12 +18,13 @@ RUN rm -rf /var/lib/apt/lists/*
|
|||||||
COPY ./conf/www.conf /etc/php7/php-fpm.d/
|
COPY ./conf/www.conf /etc/php7/php-fpm.d/
|
||||||
RUN mkdir /run/php/
|
RUN mkdir /run/php/
|
||||||
|
|
||||||
ARG WP_DIR
|
ARG WP_VOLUME_DIR
|
||||||
ARG MAX_UPLOAD_SIZE
|
ARG MAX_UPLOAD_SIZE
|
||||||
ARG EXECUTION_TIME
|
ARG EXECUTION_TIME
|
||||||
|
|
||||||
# create wp directory
|
# create and empty volume dir
|
||||||
RUN mkdir -p ${WP_DIR}
|
RUN mkdir -p ${WP_VOLUME_DIR} && \
|
||||||
|
rm -rf ${WP_VOLUME_DIR}/*
|
||||||
|
|
||||||
# replace max file size upload and execution time
|
# replace max file size upload and execution time
|
||||||
RUN sed -i "s/\(upload_max_filesize = \).*\(M\)/\1${MAX_UPLOAD_SIZE}\2/g" /etc/php7/php.ini && \
|
RUN sed -i "s/\(upload_max_filesize = \).*\(M\)/\1${MAX_UPLOAD_SIZE}\2/g" /etc/php7/php.ini && \
|
||||||
@@ -36,9 +37,6 @@ RUN adduser -S www-data && \
|
|||||||
|
|
||||||
ENV PHP_VERSION="php-fpm7"
|
ENV PHP_VERSION="php-fpm7"
|
||||||
|
|
||||||
# empty /var/www/html folder to avoid it to rewrite volume
|
|
||||||
#RUN rm -rf ${WP_DIR}/*
|
|
||||||
|
|
||||||
# install wp-cli : https://wp-cli.org/#installing
|
# install wp-cli : https://wp-cli.org/#installing
|
||||||
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
||||||
chmod +x wp-cli.phar && \
|
chmod +x wp-cli.phar && \
|
||||||
|
|||||||
@@ -13,31 +13,31 @@ RESET="\e[0m"
|
|||||||
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
||||||
# commands : https://developer.wordpress.org/cli/commands/
|
# commands : https://developer.wordpress.org/cli/commands/
|
||||||
echo -e ${YELLOW}download wordpress :${RESET}
|
echo -e ${YELLOW}download wordpress :${RESET}
|
||||||
if ! wp core version --path="${WP_DIR}" 2> /dev/null
|
if ! wp core version --path="${WP_VOLUME_DIR}" 2> /dev/null
|
||||||
then
|
then
|
||||||
mkdir -p ${WP_DIR}
|
mkdir -p ${WP_VOLUME_DIR}
|
||||||
wp core download --path="${WP_DIR}" --allow-root
|
wp core download --path="${WP_VOLUME_DIR}" --allow-root
|
||||||
else
|
else
|
||||||
echo -e ${GREEN}already there !${RESET}
|
echo -e ${GREEN}already there !${RESET}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create config file :
|
# create config file :
|
||||||
echo -e ${YELLOW}config wordpress :${RESET}
|
echo -e ${YELLOW}config wordpress :${RESET}
|
||||||
if ! wp config path --path="${WP_DIR}" --quiet 2> /dev/null
|
if ! wp config path --path="${WP_VOLUME_DIR}" --quiet 2> /dev/null
|
||||||
then
|
then
|
||||||
wp config create \
|
wp config create \
|
||||||
--dbhost="${DB_HOST}" \
|
--dbhost="${DB_HOST}" \
|
||||||
--dbname="${DB_NAME}" \
|
--dbname="${DB_NAME}" \
|
||||||
--dbuser="${DB_USER}" \
|
--dbuser="${DB_USER}" \
|
||||||
--dbpass="${DB_PSWD}" \
|
--dbpass="${DB_PSWD}" \
|
||||||
--path="${WP_DIR}" --allow-root
|
--path="${WP_VOLUME_DIR}" --allow-root
|
||||||
else
|
else
|
||||||
echo -e ${GREEN}already configured !${RESET}
|
echo -e ${GREEN}already configured !${RESET}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install wordpress :
|
# install wordpress :
|
||||||
echo -e ${YELLOW}install wordpress :${RESET}
|
echo -e ${YELLOW}install wordpress :${RESET}
|
||||||
if ! wp core is-installed --path="${WP_DIR}" 2> /dev/null
|
if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
|
||||||
then
|
then
|
||||||
wp core install \
|
wp core install \
|
||||||
--url="${WP_URL}" \
|
--url="${WP_URL}" \
|
||||||
@@ -46,19 +46,19 @@ then
|
|||||||
--admin_email="${WP_ADMIN_EMAIL}" \
|
--admin_email="${WP_ADMIN_EMAIL}" \
|
||||||
--admin_password="${WP_ADMIN_PSWD}" \
|
--admin_password="${WP_ADMIN_PSWD}" \
|
||||||
--skip-email \
|
--skip-email \
|
||||||
--path="${WP_DIR}" --allow-root
|
--path="${WP_VOLUME_DIR}" --allow-root
|
||||||
else
|
else
|
||||||
echo -e ${GREEN}already installed !${RESET}
|
echo -e ${GREEN}already installed !${RESET}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create user :
|
# create user :
|
||||||
echo -e ${YELLOW}create wordpress user :${RESET}
|
echo -e ${YELLOW}create wordpress user :${RESET}
|
||||||
if ! wp user get ${WP_USER} --path="${WP_DIR}" --field=login 2> /dev/null
|
if ! wp user get ${WP_USER} --path="${WP_VOLUME_DIR}" --field=login 2> /dev/null
|
||||||
then
|
then
|
||||||
wp user create \
|
wp user create \
|
||||||
"${WP_USER}" "${WP_USER_EMAIL}" \
|
"${WP_USER}" "${WP_USER_EMAIL}" \
|
||||||
--user_pass="${WP_USER_PSWD}" \
|
--user_pass="${WP_USER_PSWD}" \
|
||||||
--path="${WP_DIR}" --allow-root
|
--path="${WP_VOLUME_DIR}" --allow-root
|
||||||
else
|
else
|
||||||
echo -e ${GREEN}already created !${RESET}
|
echo -e ${GREEN}already created !${RESET}
|
||||||
fi
|
fi
|
||||||
@@ -68,7 +68,11 @@ chown -R www-data:www-data /var/www/*
|
|||||||
chmod 755 -R /var/www/*
|
chmod 755 -R /var/www/*
|
||||||
|
|
||||||
# symlinks for folders found in host plugins/
|
# symlinks for folders found in host plugins/
|
||||||
# todo
|
plugins=$(ls ${WP_VOLUME_PLUGIN})
|
||||||
|
for dir in $plugins; do
|
||||||
|
ln -s ${WP_VOLUME_PLUGIN}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
exec "${PHP_VERSION}" -FR
|
exec "${PHP_VERSION}" -FR
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user