11# mix docker
22
3- Put your Elixir app inside minimal docker image based on alpine linux.
4- Based on distillery releases.
3+ Put your Elixir app inside minimal Docker image.
4+ Based on [ alpine linux] ( https://hub.docker.com/r/bitwalker/alpine-erlang/ )
5+ and [ distillery] ( https://github.com/bitwalker/distillery ) releases.
56
67## Installation
78
89 1 . Add ` mix_docker ` to your list of dependencies in ` mix.exs ` :
910
1011 ``` elixir
1112 def deps do
12- [{:mix_docker , " ~> 0.2.2 " }]
13+ [{:mix_docker , " ~> 0.3.0 " }]
1314 end
1415 ```
1516
16- 2 . Configure docker image name
17+ 2 . Configure Docker image name
1718
1819 ```elixir
1920 # config/config.exs
@@ -22,6 +23,14 @@ Based on distillery releases.
2223
2324 3 . Run `mix docker.init` to init distillery release configuration
2425
26+ 4 . Run `mix docker.build` & `mix docker.release` to build the image. See [Usage ](# Usage) for more.
27+
28+
29+ ## Guides
30+
31+ - [Getting Started Tutorial ](http: // teamon.eu/ 2017 / deploying- phoenix- to- production- using- docker/ )
32+ - [Setting up cluster with Rancher ](http: // teamon.eu/ 2017 / setting- up- elixir- cluster- using- docker- and - rancher/ )
33+
2534## Usage
2635
2736## # Build a release
@@ -35,3 +44,44 @@ Run `mix docker.publish` to push newly created image to docker registry
3544
3645## # All three in one pass
3746Run `mix docker.shipit`
47+
48+ ## # Customize default Dockerfiles
49+ Run `mix docker.customize`
50+
51+
52+ ## FAQ
53+
54+ ## ## How to configure my app?
55+
56+ Using ENV variables.
57+ The provided Docker images contain `REPLACE_OS_VARS = true `, so you can use `" ${VAR_NAME}" ` syntax in `config/ prod.exs`
58+ like this:
59+
60+ ```elixir
61+ config :hello , Hello .Endpoint ,
62+ server: true ,
63+ url: [host: " ${DOMAIN}" ]
64+
65+ config :hello , Hello .Mailer ,
66+ adapter: Bamboo .MailgunAdapter ,
67+ api_key: " ${MAILGUN_API_KEY}"
68+ ```
69+
70+
71+ #### How to attach to running app using remote_console?
72+
73+ The easiest way is to ` docker exec ` into running container and run the following command,
74+ where ` CID ` is the app container IO and ` hello ` is the name of your app.
75+
76+ ``` bash
77+ docker exec -it CID /opt/app/bin/hello remote_console
78+ ```
79+
80+
81+ #### How to install additional packages into build/release image?
82+
83+ First, run ` mix docker.customize ` to copy ` Dockerfile.build ` and ` Dockerfile.release ` into your project directory.
84+ Now you can add whatever you like using standard Dockerfile commands.
85+ Feel free to add some more apk packages or run some custom commands.
86+ TIP: To keep the build process efficient check whether a given package is required only for
87+ compilation (build) or runtime (release) or both.
0 commit comments