# stage to build the dependency manager
ARG FLAVOUR
ARG FLAVOUR_PATH
ARG ELIXIR_DOCKER_IMAGE

FROM hexpm/elixir:${ELIXIR_DOCKER_IMAGE}

ENV HOME=/opt/app/ TERM=xterm USER=docker 
WORKDIR $HOME

# dev tools
RUN apk update && \
    apk add bash curl inotify-tools

# various dependencies of dependencies
RUN apk add file \
    npm yarn \
    git \
    mailcap \
    ca-certificates openssh-client openssl-dev \
    tzdata \
    gettext

# deps to compile NIF deps (eg. tree_magic)
RUN apk add git rust cargo  

# dependencies for comeonin (not needed for dev)
#RUN apk add cmake make gcc libc-dev

# dependencies for encryption (experimental)
# RUN apk add olm

# dependencies for image processing 
RUN apk add imagemagick vips-tools poppler-utils

# JS package manager & builders
# RUN npm install -g pnpm esbuild postcss

EXPOSE 4000/tcp
EXPOSE 4004/tcp

CMD ["sh","-c","iex --sname dev -S mix phx.server"]
