Detection

migetpacks detects an Elixir application when either of the following files is present in the project root:
  • mix.exs
  • mix.lock

Version Detection

Elixir Version

Elixir version is resolved in the following priority order:

Erlang/OTP Version

Erlang version is resolved from:
If no Erlang version is specified, the Elixir Docker image’s bundled Erlang/OTP version is used, which is guaranteed to be compatible.

Build Process

migetpacks generates a multi-stage Dockerfile using official Elixir images:

Phoenix Framework Detection

If mix.exs contains a :phoenix dependency, migetpacks automatically:
  1. Copies config/ early (needed for dependency compilation)
  2. Compiles assets using mix assets.deploy (or falls back to npm-based asset pipeline)
  3. Runs mix phx.digest for static file fingerprinting

Umbrella Project Detection

If an apps/ directory exists, migetpacks detects an umbrella project and copies child mix.exs files for proper dependency resolution.

Mix Releases

migetpacks detects if the project uses Mix releases by checking for releases: in mix.exs. When releases are used:
  • The release binary is self-contained (no Hex/Mix needed at runtime)
  • The runtime image is slimmer
  • The run command uses the release binary
When releases are not used:
  • Hex and Mix are copied to the runtime image
  • Git is installed at runtime (needed for git dependency verification)
  • mix phx.server is used as the run command

Run Command

The default run command depends on whether Mix releases are configured: Override with RUN_COMMAND or a Procfile:

Runtime Configuration

Caching

Layer Caching

Dependencies are cached by copying mix.exs and mix.lock before the full source:

BUILD_CACHE_DIR

When BUILD_CACHE_DIR is set, Hex and Mix dependency caches persist at:

DHI Support

Docker Hardened Images (DHI) are not supported for Elixir. Official Elixir images are used for both build and runtime stages.
When USE_DHI=true is set, migetpacks will display a warning and continue using the official Elixir images:

Example

Phoenix application

Running Phoenix

Phoenix requires SECRET_KEY_BASE at runtime. Generate one with mix phx.gen.secret or openssl rand -hex 64:
For production with a database:

With build cache