mirror of
https://github.com/casjaysdevdocker/gitea
synced 2026-06-24 02:01:03 -04:00
🐛 Fix config seed check and container env var mapping 🐛
Guard the /etc→/config seed on the primary config file rather than dir-empty so a pre-existing volume with only subdirs (e.g. custom/) does not prevent app.ini/daemon.json/default_config.yaml from being seeded — fixing the gitea install-page regression. Also wire CONTAINER_DEFAULT_DATABASE_TYPE, CONTAINER_PROTOCOL, CONTAINER_WEB_SERVER_PROTOCOL, WEB_PORT/ENV_PORTS, and DATABASE_DIR_SQLITE to the correct gitea init variables so all REPLACE_* tokens in app.ini are substituted on first start. - rootfs/usr/local/etc/docker/init.d/08-gitea.sh: seed guard checks for app.ini; map CONTAINER_DEFAULT_DATABASE_TYPE → GITEA_SQL_TYPE; map CONTAINER_PROTOCOL/WEB_PORT → SERVICE_*; fix DATABASE_DIR and CUSTOM_PATH - rootfs/usr/local/etc/docker/init.d/05-dockerd.sh: seed guard checks for daemon.json - rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh: seed guard checks for default_config.yaml rootfs/usr/local/etc/docker/init.d/05-dockerd.sh rootfs/usr/local/etc/docker/init.d/08-gitea.sh rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
@@ -263,11 +263,11 @@ __run_precopy() {
|
|||||||
# Define environment
|
# Define environment
|
||||||
local hostname=${HOSTNAME}
|
local hostname=${HOSTNAME}
|
||||||
[ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck"
|
[ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck"
|
||||||
# Seed /config/$SERVICE_NAME from the baked /etc copy on first run,
|
# Seed /config/$SERVICE_NAME from the baked /etc copy if daemon.json is missing,
|
||||||
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
||||||
# so both paths always resolve to the same processed config.
|
# so both paths always resolve to the same processed config.
|
||||||
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
||||||
if __is_dir_empty "$CONF_DIR"; then
|
if [ ! -f "$CONF_DIR/daemon.json" ]; then
|
||||||
mkdir -p "$CONF_DIR"
|
mkdir -p "$CONF_DIR"
|
||||||
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -304,11 +304,11 @@ __run_precopy() {
|
|||||||
# during container startup, after the entrypoint's initial copy. Applying it here
|
# during container startup, after the entrypoint's initial copy. Applying it here
|
||||||
# (in the init.d phase) ensures it takes effect after Docker finishes network setup.
|
# (in the init.d phase) ensures it takes effect after Docker finishes network setup.
|
||||||
[ -f "/usr/local/etc/resolv.conf" ] && cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true
|
[ -f "/usr/local/etc/resolv.conf" ] && cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true
|
||||||
# Seed /config/$SERVICE_NAME from the baked /etc copy on first run,
|
# Seed /config/$SERVICE_NAME from the baked /etc copy if app.ini is missing,
|
||||||
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
||||||
# so both paths always resolve to the same processed config.
|
# so both paths always resolve to the same processed config.
|
||||||
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
||||||
if __is_dir_empty "$CONF_DIR"; then
|
if [ ! -f "$CONF_DIR/app.ini" ]; then
|
||||||
mkdir -p "$CONF_DIR"
|
mkdir -p "$CONF_DIR"
|
||||||
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -333,11 +333,11 @@ __run_precopy() {
|
|||||||
# Define environment
|
# Define environment
|
||||||
local hostname=${HOSTNAME}
|
local hostname=${HOSTNAME}
|
||||||
[ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck"
|
[ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck"
|
||||||
# Seed /config/$SERVICE_NAME from the baked /etc copy on first run,
|
# Seed /config/$SERVICE_NAME from the baked /etc copy if default_config.yaml is missing,
|
||||||
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
|
||||||
# so both paths always resolve to the same processed config.
|
# so both paths always resolve to the same processed config.
|
||||||
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then
|
||||||
if __is_dir_empty "$CONF_DIR"; then
|
if [ ! -f "$CONF_DIR/default_config.yaml" ]; then
|
||||||
mkdir -p "$CONF_DIR"
|
mkdir -p "$CONF_DIR"
|
||||||
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user