$> 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
Last active
July 17, 2020 02:44
-
-
Save bdubaut/f78a73f19e87072a3d208b96227afbdf to your computer and use it in GitHub Desktop.
Elixir/Phoenix docker-compose setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
db: | |
image: postgres:9.6-alpine | |
api: | |
build: . | |
command: mix phx.server | |
volumes: | |
- .:/app | |
ports: | |
- "4000:4000" | |
depends_on: | |
- db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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