change: www volume managed better
This commit is contained in:
parent
49a136c709
commit
f5c5b31fbd
7 changed files with 43 additions and 38 deletions
37
Makefile
37
Makefile
|
@ -9,7 +9,7 @@ SRC_WWW_MORE=srcs/www/
|
||||||
|
|
||||||
.ONESHELL :
|
.ONESHELL :
|
||||||
.SHELLFLAGS = -eu -c
|
.SHELLFLAGS = -eu -c
|
||||||
.PHONY : run install uninstall debug re help shell
|
.PHONY : run uninstall debug re help shell
|
||||||
|
|
||||||
### pretty logs ####
|
### pretty logs ####
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ _ECHO = echoo(){ \
|
||||||
|
|
||||||
|
|
||||||
## Run the compose.
|
## Run the compose.
|
||||||
run : $(WWW_PATH)
|
run :
|
||||||
@$(_ECHO)
|
@$(_ECHO)
|
||||||
|
|
||||||
echoo "Running '$(SRC_COMPOSE)'..."
|
echoo "Running '$(SRC_COMPOSE)'..."
|
||||||
|
@ -31,31 +31,6 @@ run : $(WWW_PATH)
|
||||||
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose up --build
|
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose up --build
|
||||||
|
|
||||||
|
|
||||||
## Create WWW_PATH from wordpress' release.
|
|
||||||
install : $(WWW_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
$(WWW_PATH) :
|
|
||||||
@$(_ECHO)
|
|
||||||
|
|
||||||
echoo "Creating $(WWW_PATH) directory from wordpress release..."
|
|
||||||
|
|
||||||
rm -rf $(BUILD_PATH)
|
|
||||||
|
|
||||||
# download and uncompress release
|
|
||||||
mkdir -p $(BUILD_PATH)"/www/"
|
|
||||||
curl https://wordpress.org/latest.tar.gz | tar zx -C $(BUILD_PATH)/www
|
|
||||||
|
|
||||||
# move in WWW_PATH
|
|
||||||
rm -rf -- $(WWW_PATH)
|
|
||||||
mv $(BUILD_PATH)"/www/wordpress" $(WWW_PATH)
|
|
||||||
echo
|
|
||||||
echo "also copy files from $(SRC_WWW_MORE)"
|
|
||||||
cp -r $(SRC_WWW_MORE)/. $(WWW_PATH)
|
|
||||||
|
|
||||||
rm -rf $(BUILD_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
## Remove WWW_PATH.
|
## Remove WWW_PATH.
|
||||||
uninstall :
|
uninstall :
|
||||||
@$(_ECHO)
|
@$(_ECHO)
|
||||||
|
@ -66,10 +41,11 @@ uninstall :
|
||||||
# TODO(ugly)
|
# TODO(ugly)
|
||||||
-docker container prune
|
-docker container prune
|
||||||
-docker volume rm my-awesome-compose_db
|
-docker volume rm my-awesome-compose_db
|
||||||
|
-docker volume rm my-awesome-compose_www
|
||||||
|
|
||||||
|
|
||||||
## 'uninstall' then 'install'
|
## 'uninstall' then 'install'
|
||||||
re : uninstall install
|
re : uninstall run
|
||||||
@$(_ECHO)
|
@$(_ECHO)
|
||||||
echo
|
echo
|
||||||
echo "run \`make\` or \`make run\` to run the docker."
|
echo "run \`make\` or \`make run\` to run the docker."
|
||||||
|
@ -90,9 +66,8 @@ help :
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "run Run the compose, install WWW_PATH if necessary."
|
echo "run Run the compose, install WWW_PATH if necessary."
|
||||||
echo "install Create WWW_PATH from wordpress' release."
|
echo "uninstall TODO"
|
||||||
echo "uninstall Remove WWW_PATH."
|
echo "re 'uninstall' then 'run'."
|
||||||
echo "re 'uninstall' then 'install'."
|
|
||||||
# TODO docs shell
|
# TODO docs shell
|
||||||
echo
|
echo
|
||||||
echo "WWW_PATH is the volume directory where WordPress is installed."
|
echo "WWW_PATH is the volume directory where WordPress is installed."
|
||||||
|
|
1
TODO
1
TODO
|
@ -1,3 +1,2 @@
|
||||||
TODO later
|
TODO later
|
||||||
- dependencies between containers and check if its is working
|
- dependencies between containers and check if its is working
|
||||||
- volume www to normal volume, and create it in docker
|
|
||||||
|
|
|
@ -26,11 +26,6 @@ services:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
www:
|
www:
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
o: bind
|
|
||||||
type: none
|
|
||||||
device: "${INCEPTION_WWW_PATH:?error}"
|
|
||||||
db:
|
db:
|
||||||
|
|
||||||
### services ###
|
### services ###
|
||||||
|
|
|
@ -19,6 +19,8 @@ RUN adduser -D -S -G www www
|
||||||
|
|
||||||
# add config
|
# add config
|
||||||
COPY /conf/ /etc/php83/
|
COPY /conf/ /etc/php83/
|
||||||
|
COPY /conf/wwwmore/ /conf/wwwmore/
|
||||||
|
COPY /run.sh /run.sh
|
||||||
|
|
||||||
# start
|
# start
|
||||||
CMD ["php-fpm83", "-F"]
|
CMD ["/run.sh"]
|
||||||
|
|
34
srcs/requirements/wordpress/run.sh
Executable file
34
srcs/requirements/wordpress/run.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
dirisempty()
|
||||||
|
{
|
||||||
|
[ -z "$( ls -A "$1" )" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if dirisempty /www
|
||||||
|
then
|
||||||
|
echo "download and uncompress wordpress release..."
|
||||||
|
echo
|
||||||
|
apk add curl
|
||||||
|
apk fix
|
||||||
|
rm -rf /build
|
||||||
|
mkdir -p "/build/www/"
|
||||||
|
curl https://wordpress.org/latest.tar.gz | tar zx -C /build/www
|
||||||
|
chmod -R 777 /www
|
||||||
|
mv $(find /build/www/wordpress -maxdepth 1 -mindepth 1) /www
|
||||||
|
rm -rf /build
|
||||||
|
echo
|
||||||
|
echo "add files from /conf/wwwmore/"
|
||||||
|
echo
|
||||||
|
cp -r /conf/wwwmore/. /www
|
||||||
|
echo "www directory created!"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "to recreate the www directory, remove the www volume of this compose."
|
||||||
|
echo
|
||||||
|
|
||||||
|
php-fpm83 -F
|
Loading…
Add table
Reference in a new issue