Skip to content

Instantly share code, notes, and snippets.

@pointcom
Created October 7, 2017 16:17
Show Gist options
  • Save pointcom/c3429c30b2211ca5c529dd3fe1a99af4 to your computer and use it in GitHub Desktop.
Save pointcom/c3429c30b2211ca5c529dd3fe1a99af4 to your computer and use it in GitHub Desktop.
Phoenix project dockerized
version: "3"
services:
web:
build: .
volumes:
- ".:/app"
ports:
- "4000:4000"
command: "iex -S mix phx.server"
db:
image: "postgres:10.0"
environment:
POSTGRES_DB: "<my-project-name>_dev"
FROM elixir:1.5.0
WORKDIR /app
# Install Hex
RUN mix local.hex --force
# Install rebar3
# Needed to compile dependency :ranch
RUN mix local.rebar --force
# Install Phoenix archive
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez
RUN apt-get update
## Workaround to install Node and NPM:
# https://github.com/npm/npm/issues/17996
#
# install outdated stock npm, than use it to upgrade itself to the intermediate version
RUN apt-get install -y npm && \
npm install -g npm@4.3.0 && \
ln -s /usr/bin/nodejs /usr/bin/node
# upgrade node via npm by installing n and using it to manage nodes
RUN npm install -g n && n latest
# Install inotify
# Watcher that Phoenix uses for live code reloading
RUN apt-get install -y inotify-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment