Skip to content
Snippets Groups Projects
Dockerfile 1.31 KiB
Newer Older
Michael Bücker's avatar
Michael Bücker committed
FROM jupyter/datascience-notebook:hub-3.1.1
Peter Vennemann's avatar
Peter Vennemann committed

Michael Bücker's avatar
Michael Bücker committed
# Use root to install packages and modify permissions
Peter Vennemann's avatar
Peter Vennemann committed
USER root

Michael Bücker's avatar
Michael Bücker committed
# Copy requirements and environment files to the container
COPY requirements.txt environment.yml /tmp/
Michael Bücker's avatar
Michael Bücker committed

Michael Bücker's avatar
Michael Bücker committed
# Update conda environment
RUN conda env update -q -f /tmp/environment.yml

# Install pip packages and avoid caching
RUN /opt/conda/bin/pip install --no-cache-dir -r /tmp/requirements.txt
Michael Bücker's avatar
Michael Bücker committed

# Fix permissions for the pip cache directory to avoid permission warnings
RUN chown -R jovyan:users /home/jovyan/.cache
Michael Bücker's avatar
Michael Bücker committed
# Ensure numpy and scikit-learn are compatible
RUN /opt/conda/bin/pip install --no-cache-dir numpy==1.22.0 scikit-learn==1.2.2

Michael Bücker's avatar
Michael Bücker committed
# Clean up conda cache
RUN conda clean -y --all

# Build Jupyter Lab
RUN jupyter lab build

# Install NLTK and SpaCy data
RUN python -m nltk.downloader stopwords
RUN python -m nltk.downloader wordnet
RUN python -m spacy download en_core_web_sm

Michael Bücker's avatar
Michael Bücker committed
# Copy and install custom packages
COPY dash_proxy /tmp/dash_proxy/
Michael Bücker's avatar
Michael Bücker committed
RUN pip install --no-cache-dir /tmp/dash_proxy/
COPY llm_utils /llm_utils/
Michael Bücker's avatar
Michael Bücker committed
RUN pip install --no-cache-dir /llm_utils/

# Set environment variable for config path
ENV CONFIG_PATH=/home/jovyan/config.txt
Michael Bücker's avatar
Michael Bücker committed
# Copy application files and adjust permissions for the jovyan user
COPY app /dash/app/
Michael Bücker's avatar
Michael Bücker committed
RUN chown -R jovyan:users /dash/app/
Michael Bücker's avatar
Michael Bücker committed
# Switch back to jovyan user
USER jovyan