From 739aefa823fd64e802b2056fd2010e81de7938a5 Mon Sep 17 00:00:00 2001 From: Chingis S Date: Tue, 18 Aug 2026 17:52:58 +0300 Subject: [PATCH] Apply the service init action on container start Service init actions such as init-drupal and init prepare the application codebase for the image: they wire the generated Wodby config into the application's own settings file and symlink public directories to the persistent files volume. Until now they ran only as a RUN step in the service Dockerfile, so an image built from a user-provided Dockerfile silently skipped them and the application started against an uninitialized codebase. Add /docker-entrypoint-init.d/90_wodby_init.sh, which applies the target named by WODBY_INIT_ACTION. The variable is supplied as an environment variable rather than baked into the image, so the init action is applied no matter which Dockerfile produced the image. The init steps are guarded and idempotent, so this is a no-op when the action was already applied during the build, and the script does nothing at all when the variable is unset. --- 8/Dockerfile | 1 + 8/init/90_wodby_init.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 8/init/90_wodby_init.sh diff --git a/8/Dockerfile b/8/Dockerfile index c57f67e2..2a8aab91 100644 --- a/8/Dockerfile +++ b/8/Dockerfile @@ -457,6 +457,7 @@ EXPOSE 9000 COPY templates /etc/gotpl/ COPY docker-entrypoint.sh / COPY bin /usr/local/bin/ +COPY init /docker-entrypoint-init.d/ ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["sudo", "-E", "php-fpm"] diff --git a/8/init/90_wodby_init.sh b/8/init/90_wodby_init.sh new file mode 100755 index 00000000..85542171 --- /dev/null +++ b/8/init/90_wodby_init.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +if [[ -n "${DEBUG}" ]]; then + set -x +fi + +# Applies the service init action on container start. +# +# The init action prepares the application codebase for this image, for example +# by wiring the generated Wodby config into the application's own settings file +# and symlinking public files to the persistent volume. Its steps are guarded +# and idempotent, so when the image was built with the init action already +# applied this is a no-op. +# +# WODBY_INIT_ACTION names a target in /usr/local/bin/actions.mk and is provided +# as an environment variable rather than baked into the image, so the init +# action is applied no matter which Dockerfile produced the image. +# +# This file is sourced by exec_init_scripts, not executed in a subshell. Do not +# use "exit" here, it would terminate the entrypoint and stop the container. +if [[ -n "${WODBY_INIT_ACTION}" ]]; then + echo "Applying init action: ${WODBY_INIT_ACTION}" + make "${WODBY_INIT_ACTION}" -f /usr/local/bin/actions.mk +fi