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

Commit b5393ef

Browse files
alex-kovshovikteamon
authored andcommitted
Add Phoenix deployment tips to Readme
1 parent 6cea452 commit b5393ef

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and [distillery](https://github.com/bitwalker/distillery) releases.
3232

3333
- [Getting Started Tutorial](http://teamon.eu/2017/deploying-phoenix-to-production-using-docker/)
3434
- [Setting up cluster with Rancher](http://teamon.eu/2017/setting-up-elixir-cluster-using-docker-and-rancher/)
35+
- [Phoenix App Configuration Walkthrough](https://shovik.com/blog/8-deploying-phoenix-apps-with-docker)
3536

3637
## Usage
3738

@@ -87,3 +88,52 @@ Now you can add whatever you like using standard Dockerfile commands.
8788
Feel free to add some more apk packages or run some custom commands.
8889
TIP: To keep the build process efficient check whether a given package is required only for
8990
compilation (build) or runtime (release) or both.
91+
92+
93+
#### How to configure a Phoenix app?
94+
95+
To run a Phoenix app you'll need to install additional packages into the build image: run `mix docker.customize`.
96+
97+
Modify the `apk --no-cache --update add` command in the `Dockerfile.build` as follows (add `nodejs` and `python`):
98+
99+
```
100+
# Install Elixir and basic build dependencies
101+
RUN \
102+
echo "@edge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
103+
apk update && \
104+
apk --no-cache --update add \
105+
git make g++ \
106+
nodejs python \
107+
elixir@edge && \
108+
rm -rf /var/cache/apk/*
109+
```
110+
111+
Install nodejs dependencies and cache them by adding the following lines before the `COPY` command:
112+
113+
```
114+
# Cache node deps
115+
COPY package.json ./
116+
RUN npm install
117+
```
118+
119+
Build and digest static assets by adding the following lines after the `COPY` command:
120+
121+
```
122+
RUN ./node_modules/brunch/bin/brunch b -p && \
123+
mix phoenix.digest
124+
```
125+
126+
Add the following directories to `.dockerignore`:
127+
128+
```
129+
node_modules
130+
priv/static
131+
```
132+
133+
Remove `config/prod.secret.exs` file and remove a reference to it from `config/prod.exs`. Configure your app's secrets directly in `config/prod.exs` using the environment variables.
134+
135+
Make sure to add `server: true` to your app's Endpoint config.
136+
137+
Build the images and run the release image normally.
138+
139+
Check out [this post](https://shovik.com/blog/8-deploying-phoenix-apps-with-docker) for detailed walkthrough of the Phoenix app configuration.

0 commit comments

Comments
 (0)