Skip to content

Instantly share code, notes, and snippets.

@bdubaut
Last active July 17, 2020 02:44
Show Gist options
  • Save bdubaut/f78a73f19e87072a3d208b96227afbdf to your computer and use it in GitHub Desktop.
Save bdubaut/f78a73f19e87072a3d208b96227afbdf to your computer and use it in GitHub Desktop.
Elixir/Phoenix docker-compose setup

Elixir project docker setup for development

$> docker-compose run api mix new . --app <my_app>

# if building a phoenix app:
$> docker-compose run api mix ecto.create
$> docker-compose run api env MIX_ENV=test mix ecto.create
version: "3"
services:
db:
image: postgres:9.6-alpine
api:
build: .
command: mix phx.server
volumes:
- .:/app
ports:
- "4000:4000"
depends_on:
- db
FROM elixir:1.5.3-alpine
WORKDIR /app
ADD . /app
# Install hex & rebar
RUN mix local.hex --force && \
mix local.rebar --force && \
mix hex.info
EXPOSE 4000
# Intall phoenix
ENV PHOENIX_VERSION=1.3.0
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new-${PHOENIX_VERSION}.ez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment