DockerBuild v0.3.1 DockerBuild.Plugins behaviour View Source

A behaviour for a plugin system allowing functionality to be extended when building the docker image.

By implementing the optional callbacks the docker file can be changed at various points.

All callbacks are optional.

Creating a plugin

  1. Create module e.g. MyProject.MyPlugin
  2. Add use DockerBuild.Plugins
  3. Implement the required callbacks to modify the docker file or .dockerignore
  4. To fetch a plugin config value with the plugin callback use plugin_config(context, key) where context is either the config or df parameter passed to the callback.

Link to this section Summary

Types

The dockerfile config

The dockerfile

Callbacks

Invoked to discover the command to use for compiling assets.

Invoked before copying assets into the docker image

Invoked before getting mix dependencies

Invoked when creating the .dockerignore file.

Link to this section Types

Link to this type

config()

View Source
config() :: %DockerBuild.Config{base_config: term(), plugin_configs: term()}

The dockerfile config

Link to this type

df()

View Source
df() :: %DockerBuild.Dockerfile{config: term(), instructions: term()}

The dockerfile

Link to this section Callbacks

Link to this callback

assets_compile_command(config)

View Source (optional)
assets_compile_command(config()) :: [String.t()]

Invoked to discover the command to use for compiling assets.

Only one plugin should be used that implements this function.

Link to this callback

before_assets_copy(df)

View Source (optional)
before_assets_copy(df()) :: df()

Invoked before copying assets into the docker image

Link to this callback

before_deps_get(df)

View Source (optional)
before_deps_get(df()) :: df()

Invoked before getting mix dependencies

Link to this callback

extra_dockerignore(config)

View Source (optional)
extra_dockerignore(config()) :: [String.t()]

Invoked when creating the .dockerignore file.

A list of addition lines can be returned which are added to the file.