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

This commit is contained in:
Christian Winther 2024-01-26 20:19:34 +00:00
parent aa2669c327
commit 5c208d0519
3 changed files with 14 additions and 0 deletions

View file

@ -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) # 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" 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. # Automatically run "One-time setup tasks" commands.
# #
# If you are migrating to this docker-compose setup or have manually run the "One time seutp" # If you are migrating to this docker-compose setup or have manually run the "One time seutp"

View file

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

View file

@ -11,6 +11,9 @@ export ENTRYPOINT_ROOT
: "${ENTRYPOINT_D_ROOT:="${ENTRYPOINT_ROOT}/entrypoint.d/"}" : "${ENTRYPOINT_D_ROOT:="${ENTRYPOINT_ROOT}/entrypoint.d/"}"
export ENTRYPOINT_D_ROOT 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 # Space separated list of scripts the entrypoint runner should skip
: "${ENTRYPOINT_SKIP_SCRIPTS:=""}" : "${ENTRYPOINT_SKIP_SCRIPTS:=""}"
@ -37,6 +40,12 @@ if directory-is-empty "${ENTRYPOINT_D_ROOT}"; then
exec "$@" exec "$@"
fi 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" acquire-lock "entrypoint.sh"
# Start scanning for entrypoint.d files to source or run # Start scanning for entrypoint.d files to source or run