Skip to content
This repository was archived by the owner on Jun 13, 2019. It is now read-only.

Recruitee/mix_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mix docker

Put your Elixir app inside minimal Docker image. Based on alpine linux and distillery releases.

Installation

  1. Add mix_docker to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:mix_docker, "~> 0.3.0"}]
end
```
  1. Configure Docker image name
```elixir
# config/config.exs
config :mix_docker, image: "recruitee/hello"
```
  1. Run mix docker.init to init distillery release configuration

  2. Run mix docker.build & mix docker.release to build the image. See Usage for more.

Guides

Usage

Build a release

Run mix docker.build to build a release inside docker container

Create minimal run container

Run mix docker.release to put the release inside minimal docker image

Publish to docker registry

Run mix docker.publish to push newly created image to docker registry

All three in one pass

Run mix docker.shipit

Customize default Dockerfiles

Run mix docker.customize

FAQ

How to configure my app?

Using ENV variables. The provided Docker images contain REPLACE_OS_VARS=true, so you can use "${VAR_NAME}" syntax in config/prod.exs like this:

config :hello, Hello.Endpoint,
  server: true,
  url: [host: "${DOMAIN}"]    

config :hello, Hello.Mailer,
  adapter: Bamboo.MailgunAdapter,
  api_key: "${MAILGUN_API_KEY}"

How to attach to running app using remote_console?

The easiest way is to docker exec into running container and run the following command, where CID is the app container IO and hello is the name of your app.

docker exec -it CID /opt/app/bin/hello remote_console

How to install additional packages into build/release image?

First, run mix docker.customize to copy Dockerfile.build and Dockerfile.release into your project directory. Now you can add whatever you like using standard Dockerfile commands. Feel free to add some more apk packages or run some custom commands. TIP: To keep the build process efficient check whether a given package is required only for compilation (build) or runtime (release) or both.

About

Put your Elixir app production release inside minimal docker image

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

Languages