fixed the pbm of wp cron job not working

This commit is contained in:
asus
2024-04-02 11:37:41 +02:00
parent 3c0a32e6ac
commit ce6d6b442a
3 changed files with 18 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
FROM alpine:3.15
RUN apk update
@@ -49,4 +48,3 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
COPY ./conf/wp_entrypoint.sh ./
ENTRYPOINT [ "sh", "wp_entrypoint.sh" ]

View File

@@ -12,6 +12,18 @@ RESET="\e[0m"
# it gets the ENV variables from .env because specified in the docker-compose.yml file
# this is to make the wp_cron job works
# ! it might not be a very strong solution
#
# somehow it didn't work if the local adress is not accessible from inside the wordpress container :
# if : `curl <PROJECT_URL>` don't work, the cron job does not either (why ?)
# to make it work, i mapped the docker network gateway ip to the url (without understanding what i'm doing)
# the default network is named bridge, and it's gateway is 172.17.0.1 : https://docs.docker.com/network/network-tutorial-standalone/
# also might help, even though i didn't use, it helped me find the ip 172.17.0.1 : https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach?rq=2
echo "172.17.0.1 ${PROJECT_URL}" >> /etc/hosts
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
# commands : https://developer.wordpress.org/cli/commands/
# bug with wp commands : https://github.com/wp-cli/config-command/issues/31