-
-
Save randito/65bba184eb8c631646ed15b48e507d63 to your computer and use it in GitHub Desktop.
elixir and phoenixframework with docker-compose
This file contains hidden or 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
# 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: |
This file contains hidden or 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: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