فهرست منبع

allow easy overrides of any and all files in container via new override mount

Christian Winther 1 سال پیش
والد
کامیت
5c208d0519
3فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 3 0
      .env.docker
  2. 2 0
      docker-compose.yml
  3. 9 0
      docker/shared/root/docker/entrypoint.sh

+ 3 - 0
.env.docker

@@ -982,6 +982,9 @@ DOCKER_APP_HOST_STORAGE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/pixelfed/storage
 # Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
 DOCKER_APP_HOST_CACHE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/pixelfed/cache"
 
+# Path (relative to the docker-compose.yml) or absolute (/some/other/path) where containers will store overrides
+DOCKER_APP_HOST_OVERRIDES_PATH="${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/overrides"
+
 # Automatically run "One-time setup tasks" commands.
 #
 # If you are migrating to this docker-compose setup or have manually run the "One time seutp"

+ 2 - 0
docker-compose.yml

@@ -84,6 +84,7 @@ services:
       - "./.env:/var/www/.env"
       - "${DOCKER_APP_HOST_CACHE_PATH}:/var/www/bootstrap/cache"
       - "${DOCKER_APP_HOST_STORAGE_PATH}:/var/www/storage"
+      - "${DOCKER_APP_HOST_OVERRIDES_PATH}:/docker/overrides:ro"
     environment:
       LETSENCRYPT_HOST: "${LETSENCRYPT_HOST}"
       LETSENCRYPT_EMAIL: "${LETSENCRYPT_EMAIL}"
@@ -126,6 +127,7 @@ services:
       - "./.env:/var/www/.env"
       - "${DOCKER_APP_HOST_CACHE_PATH}:/var/www/bootstrap/cache"
       - "${DOCKER_APP_HOST_STORAGE_PATH}:/var/www/storage"
+      - "${DOCKER_APP_HOST_OVERRIDES_PATH}:/docker/overrides:ro"
     depends_on:
       - db
       - redis

+ 9 - 0
docker/shared/root/docker/entrypoint.sh

@@ -11,6 +11,9 @@ export ENTRYPOINT_ROOT
 : "${ENTRYPOINT_D_ROOT:="${ENTRYPOINT_ROOT}/entrypoint.d/"}"
 export ENTRYPOINT_D_ROOT
 
+: "${DOCKER_APP_HOST_OVERRIDES_PATH:="${ENTRYPOINT_ROOT}/overrides"}"
+export DOCKER_APP_HOST_OVERRIDES_PATH
+
 # Space separated list of scripts the entrypoint runner should skip
 : "${ENTRYPOINT_SKIP_SCRIPTS:=""}"
 
@@ -37,6 +40,12 @@ if directory-is-empty "${ENTRYPOINT_D_ROOT}"; then
     exec "$@"
 fi
 
+# If the overridess directory exists, then copy all files into the container
+if ! directory-is-empty "${DOCKER_APP_HOST_OVERRIDES_PATH}"; then
+    log-info "Overrides directory is not empty, copying files"
+    run-as-current-user cp --verbose --recursive "${DOCKER_APP_HOST_OVERRIDES_PATH}/." /
+fi
+
 acquire-lock "entrypoint.sh"
 
 # Start scanning for entrypoint.d files to source or run