FROM python:3
LABEL maintainer="SED RA <sed-gra@inria.fr>"

# Ensure a sane environment
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

# Update the image & install some tools
RUN apt update && apt -y dist-upgrade && \
    pip --no-cache-dir install jupyter

# Set arguments
ARG user=karadoc
ARG home=/kaamelott/kitchen
# Create the user and its directory
RUN mkdir -p $home && \
    useradd $user --home-dir $home && \
    chown -R $user: $home

# Switch to the new user
USER $user
# Change working directory
RUN mkdir $home/notebooks
WORKDIR $home/notebooks

# Set the default entry point & arguments
ENTRYPOINT ["jupyter", "notebook", "--no-browser"]
CMD ["--port=8888", "--ip='*'",  "--NotebookApp.token=''"]