Skip to content

Apply the service init action on container start - #218

Merged
csandanov merged 1 commit into
masterfrom
codex/init-action-on-start
Aug 18, 2026
Merged

Apply the service init action on container start#218
csandanov merged 1 commit into
masterfrom
codex/init-action-on-start

Conversation

@csandanov

Copy link
Copy Markdown
Member

Summary

Service init actions (init-drupal, init-laravel, init-wordpress, 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. An application that builds from its own Dockerfile replaces that file, so the init step was silently dropped. The build succeeded, the container passed its readiness probe, the deployment reported success, and the application started against an uninitialized codebase.

This adds /docker-entrypoint-init.d/90_wodby_init.sh, which applies the actions.mk target named by WODBY_INIT_ACTION. Because the variable is supplied as an environment variable rather than baked into the image, the init action is applied no matter which Dockerfile produced the image.

Behaviour

  • Does nothing when WODBY_INIT_ACTION is unset, so standalone and Docker Compose usage is unchanged.
  • Init targets are guarded and idempotent, so this is a no-op when the action was already applied during the build.
  • Sourced by exec_init_scripts rather than executed in a subshell, so it uses an if block. An exit here would terminate the entrypoint and stop the container.
  • Named 90_ so it runs after the existing 10_/20_ scripts that generate the config it references.

Follow-up

Service manifests declare WODBY_INIT_ACTION and drop their build-time init step in a separate change. That change requires this image to be released first.

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.
@csandanov
csandanov merged commit e5fed5c into master Aug 18, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant