2017-11-07

Phoenix framework Dockerfile and compose

Dockerfile

# Instructions for bootstrapping
# docker-compose run --rm web mix phx.new . --app my_app_name
# docker-compose run --rm web mix phx.new . --app phoenix_docker --no-brunch --no-ecto
# mix compile
#

FROM elixir:latest

MAINTAINER Eric Young

# Install NodeJS 6.x and the NPM
# inotify-tools for live-reload of course, not for production

WORKDIR /app

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -

RUN apt-get install -y -q inotify-tools nodejs

RUN mix local.hex --force
RUN mix local.rebar --force

RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez

CMD bash



dockerfile.yml

version: '2'
services:
  web:
    build: .
    ports:
      - "4000:4000" # http
      - "35729:35729" # live-reload
    command: mix phx.server
    environment:
      - MIX_ENV=dev
      - PORT=4000
    volumes:
      - .:/app
    depends_on:
      - postgres
  postgres:
    image: postgres
    environment:
      # POSTGRES_USER: postgres #default
      POSTGRES_PASSWORD: postgres