DockerBuild.Plugins behaviour (DockerBuild v0.11.0) 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 before compiling - can be used to install any development dependencies, e.g. linux packages

Invoked before getting mix dependencies

Invoked before copying all source files

Dependent plugins

Invoked when creating the .dockerignore file.

Invoked at start to install any build dependencies - e.g linux packages

Invoked at start to install any runtime dependencies - e.g linux packages

Link to this section Types

Specs

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

The dockerfile config

Specs

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

The dockerfile

Link to this section Callbacks

Link to this callback

before_compile(df)

View Source (optional)

Specs

before_compile(df()) :: df()

Invoked before compiling - can be used to install any development dependencies, e.g. linux packages

Link to this callback

before_deps_get(df)

View Source (optional)

Specs

before_deps_get(df()) :: df()

Invoked before getting mix dependencies

Link to this callback

before_source_copy(df)

View Source (optional)

Specs

before_source_copy(df()) :: df()

Invoked before copying all source files

Specs

deps() :: [module()]

Dependent plugins

Link to this callback

extra_dockerignore(config)

View Source (optional)

Specs

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.

Link to this callback

install_build_deps(df)

View Source (optional)

Specs

install_build_deps(df()) :: df()

Invoked at start to install any build dependencies - e.g linux packages

Link to this callback

install_runtime_deps(df)

View Source (optional)

Specs

install_runtime_deps(df()) :: df()

Invoked at start to install any runtime dependencies - e.g linux packages