Girish Ramakrishnan 10 سال پیش
والد
کامیت
e722fe3539
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 1 0
      Dockerfile
  2. 5 2
      start.sh

+ 1 - 0
Dockerfile

@@ -12,6 +12,7 @@ ADD start.sh /app/code/start.sh
 RUN chmod +x /app/code/start.sh
 
 ADD wp-config.php.template /app/configs/wp-config.php.template
+RUN ln -sf /app/data/wp-config.php /app/code/wp-config.php
 
 # configure apache
 RUN rm /etc/apache2/sites-enabled/*

+ 5 - 2
start.sh

@@ -3,11 +3,14 @@
 set -eux
 
 if [[ -z "$(ls -A /app/data)" ]]; then
-    ln -sf /app/data/wp-config.php /app/code/wp-config.php
+    echo "Copying wp-content files on first run"
     mv /app/code/wp-content /app/data/wp-content/
-    ln -s /app/data/wp-content /app/code/wp-content
 fi
 
+[[ ! -L "/app/code/wp-content" ]] && rm -rf /app/code/wp-content # upgrades & updates - starting out with existing data
+
+ln -sf /app/data/wp-content /app/code/wp-content
+
 : ${MYSQL_URL:=}
 if [[ -z "${MYSQL_URL}" ]]; then
     echo "MYSQL_URL is empty"