# Dockerfile for JupyterHub with authenticator
FROM jupyterhub/jupyterhub:5.3.0

USER root

RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir \
    git+https://github.com/jupyterhub/nativeauthenticator.git@main \
    oauthenticator \
    jupyterhub-idle-culler \
    jupyterlab \
    notebook

# Create the directory structure JupyterHub expects for DB
# JupyterHub joins data_files_path + dirname(db_path), so we create the composed path
RUN mkdir -p /srv/jupyterhub/srv/jupyterhub && \
    chown -R 1000:1000 /srv/jupyterhub

COPY jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py

WORKDIR /srv/jupyterhub

EXPOSE 8000

CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]
