How to update wordpress on docker

后端 未结 5 554
再見小時候
再見小時候 2021-02-06 07:36

I\'m running a php-fpm wordpress container.

The wordpress source files are mounted in a named volume "wordpress" shared with the Nginx container.

Everyth

5条回答
  •  情深已故
    2021-02-06 08:34

    Thank you for your help. It worked. Here is the code i'm using.

    I overriden the entrypoint in dockerfile

    COPY check-wordpress-version.sh /usr/local/bin/
    
    ENTRYPOINT ["check-wordpress-version.sh"]
    

    Here is the content of check-wordpress-version.sh to check wordpress current version.

    VOLUME_VERSION="$(php -r 'require('"'"'/var/www/html/wp-includes/version.php'"'"'); echo $wp_version;')"
    echo "Volume version : "$VOLUME_VERSION
    echo "WordPress version : "$WORDPRESS_VERSION
    
    if [ $VOLUME_VERSION != $WORDPRESS_VERSION ]; then
        echo "Forcing WordPress code update..."
        rm -f /var/www/html/index.php
    fi
    
    docker-entrypoint.sh php-fpm
    

提交回复
热议问题