Apply the service init action on container start - #218
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
RUNstep 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 theactions.mktarget named byWODBY_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
WODBY_INIT_ACTIONis unset, so standalone and Docker Compose usage is unchanged.exec_init_scriptsrather than executed in a subshell, so it uses anifblock. Anexithere would terminate the entrypoint and stop the container.90_so it runs after the existing10_/20_scripts that generate the config it references.Follow-up
Service manifests declare
WODBY_INIT_ACTIONand drop their build-time init step in a separate change. That change requires this image to be released first.