FROM elixir

ENV MIX_ENV=prod

ENV VERSION 7bd4c145

RUN apt update && apt -y upgrade && apt -y install build-essential git imagemagick && apt clean

RUN adduser --system --disabled-password --home /pleroma pleroma

USER pleroma
WORKDIR /pleroma

RUN git clone https://git.pleroma.social/pleroma/pleroma /pleroma \
    && mkdir -p /pleroma/uploads

#RUN git checkout $VERSION

RUN touch /pleroma/config/prod.secret.exs \
    && mix local.rebar --force \
    && mix local.hex --force \
    && mix deps.get \
    && mix deps.compile \
    && rm /pleroma/config/prod.secret.exs

EXPOSE 4000

