FROM elixir:latest

# Set environment variables for building the application
ENV MIX_ENV=dev \
    TEST=1 \
    LANG=C.UTF-8

RUN apt-get update && \
    apt-get install -y postgresql-client && \
    apt-get install -y inotify-tools && \
    apt-get install -y nodejs && \
    curl -L https://npmjs.org/install.sh | sh && \
    mix local.hex --force && \
    mix archive.install hex phx_new 1.5.3 --force && \
    mix local.rebar --force

# Create the application build directory
RUN mkdir /app
WORKDIR /app

CMD ["mix", "phx.server"]
