FROM trenpixster/elixir:1.3.3

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    libxml2-dev \
    python \
    build-essential \
    make \
    gcc \
    python-dev \
    locales \
    python-pip

RUN pip install --upgrade youtube_dl && mkdir /download

RUN mkdir /app
WORKDIR /app
ADD mix.* ./
RUN MIX_ENV=prod mix local.rebar
RUN MIX_ENV=prod mix local.hex --force
RUN MIX_ENV=prod mix deps.get

ADD . .
RUN MIX_ENV=prod mix compile
RUN MIX_ENV=prod mix phoenix.digest
RUN ulimit -n 10000
EXPOSE 4000
CMD  PORT=4000 MIX_ENV=prod mix phoenix.server
