FROM elixir:1.13.2-slim

RUN apt-get update && \
	apt-get -y --no-install-recommends install git curl ca-certificates && \
	apt-get autoremove -y && \
	apt-get clean && \
	rm -rf /var/lib/apt/lists

# install livebook
RUN mix local.hex --force && mix local.rebar --force
RUN mix escript.install --force github livebook-dev/livebook

ENV LIVEBOOK_IP 0.0.0.0
ENV LIVEBOOK_HOME /app
ENV LIVEBOOK_PORT 5588
ENV LIVEBOOK_IFRAME_PORT 5589

EXPOSE 5588/tcp
EXPOSE 5589/tcp

WORKDIR /app

ADD . /app

RUN mix do deps.get, compile
CMD ["/root/.mix/escripts/livebook", "server", "--default-runtime", "mix", "--no-token"]