Adding Solid Docker Compose Recipes

With pleasure !

Here is the new project directory:

The Dockerfile :

FROM elixir:latest


RUN mix local.hex --force &&\
    mix local.rebar --force &&\
    #This part could be removed as we do not need to install phoenix dependencies.
    mix archive.install hex phx_new 1.4.16 --force

RUN apt-get update && \
  ## install inotify-tool for phoenix hot reload
  apt-get install -y inotify-tools && \
  # install nodejs and npm on globaly
  curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
   apt-get install -y -q nodejs && \
  # Install postgres client
  apt-get install -y postgresql-client && \
  # Clear apt cache
   rm -rf /var/lib/apt/lists/*

WORKDIR /phoenix

COPY . /phoenix

EXPOSE 4000

The docker-compose file:

version: '3.7'

services:
  db:
    image: postgres:9.6
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      PGDATA: /var/lib/postgresql/data/pgdata
    restart: always
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
  phoenix:
    build: .
    volumes:
      - .docker/phoenix/phoenix-setup.sh:/phoenix-setup.sh
    command: ../phoenix-setup.sh
    environment:
      PGUSER: postgres
      PGPASSWORD: postgres
      PGDATABASE: portfolio
      PGPORT: 5432
      PGHOST: db
    ports:
      - "4000:4000"
    depends_on:
      - db
volumes:
  pgdata:

And .dockerignore:

deps
_build
assets/node_modules
test

If you have any suggestion/reviews I will love to hear them.

Thanks a lot !