Skip to content

Instantly share code, notes, and snippets.

@randito
Forked from juanpabloaj/Dockerfile
Created March 4, 2020 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randito/65bba184eb8c631646ed15b48e507d63 to your computer and use it in GitHub Desktop.
Save randito/65bba184eb8c631646ed15b48e507d63 to your computer and use it in GitHub Desktop.
elixir and phoenixframework with docker-compose
# docker-compose up -d
# docker-compose exec dev bash
# mix phx.new new_project
# in new_project/config/dev.exs replace hostname: "localhost" to hostname: "db",
# cd new_project && mix ecto.create && mix phx.server
version: '3'
services:
dev:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/code
ports:
- 4000:4000
stdin_open: true
tty: true
depends_on:
- db
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
volumes:
phoenix_code:
FROM elixir:slim
# install Node.js (>= 8.0.0) and NPM in order to satisfy brunch.io dependencies
# See https://hexdocs.pm/phoenix/installation.html#node-js-5-0-0
RUN apt-get update -y && \
apt-get install -y curl git && \
curl -sL https://deb.nodesource.com/setup_13.x | bash - && \
apt-get install -y inotify-tools nodejs
WORKDIR /code
RUN useradd -c 'phoenix user' -m -d /home/pho -s /bin/bash pho && \
chown -R pho.pho /code
USER pho
# install the Phoenix Mix archive
RUN mix local.hex --force && \
mix local.rebar --force && \
mix archive.install hex phx_new --force
ENV HOME /home/pho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment