Popularity
3.6
Growing
Activity
3.3
-
23
4
0

Description

Dockerize is an Elixir package that helps you create Docker images from Elixir projects.

Monthly Downloads: 0
Programming language: Elixir
License: MIT License

dockerize alternatives and similar packages

Based on the "Deployment" category.
Alternatively, view dockerize alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of dockerize or a related project?

Add another 'Deployment' Package

README

Dockerize is an Elixir package that helps you create Docker images from Elixir projects.

Prerequirements

  • Elixir >= 1.9

Install

mix archive.install hex dockerize

Getting Started

1. Generate configurations from template

Run this command in your project directory:

mix dockerize.init

2. Build your docker image

just run docker build, for example

docker build .

# or optionally run with buildkit:
# DOCKER_BUILDKIT=1 docker build .

Done!

Now you are free to do anything with the docker image built, either run it locally or host it on your infrastructures, e.g a Kubernete cluster.

For more information of docker build, please refer to the official document.

Customizing

Phoenix projects without assets

By default, it speculates if it's running in a phoenix project or not, by information from Mix.Project.config(). So basically you have to do nothing specially. But if your phoenix project doesn't have assets, you could use the --no-phoenix-assets parameter on generating the Dockerfile.

Use different app name other than directory name

By default, it speculates app_name from the directory name. You can change it by:

mix dockerize.init --app my_app

use MIX_ENV other than prod

By default, it build the image with MIX_ENV=prod. You can change MIX_ENV value by providing it as an build argument:

docker build --build-arg mix_env=dev .

use HEX_MIRROR other than default (https://repo.hex.pm)

If you are in China, you may want to use some hex mirror:

docker build --build-arg hex_mirror_url=https://hexpm.upyun.com .

Docker images underhood

There are two base docker images used:

  • elixir-runner

    • A final runtime environment for running your release.
    • This image is based on Alpine which is very small.
    • There are some useful utility tools installed out of the box.
  • elixir-builder

    • A build-time environment
    • Used for building the final minimum docker image to distribute.
    • Suitable for CI/CD uses.