# Use a base image with Python and JupyterLab already installed for convenience | |
# This saves some steps and reduces image size by leveraging existing layers | |
FROM jupyter/scipy-notebook:latest | |
LABEL maintainer="Your Name <your.email@example.com>" | |
# Install Hugging Face Transformers and other common NLP/ML libraries | |
# Use --no-cache-dir to prevent caching pip packages, reducing image size | |
# Use a specific version for reproducibility, e.g., transformers==4.41.2 | |
# Add other libraries you commonly use (e.g., datasets, evaluate, accelerate, sentencepiece, bitsandbytes) | |
RUN pip install --no-cache-dir \ | |
transformers \ | |
datasets \ | |
evaluate \ | |
accelerate \ | |
sentencepiece \ | |
tokenizers \ | |
diffusers \ | |
scikit-learn \ | |
pandas \ | |
numpy \ | |
matplotlib \ | |
seaborn | |
# Set the working directory inside the container | |
WORKDIR /home/jovyan/work | |
# You can expose the Jupyter Lab port (default is 8888) | |
EXPOSE 8888 | |
# Command to run Jupyter Lab | |
# --ip=0.0.0.0 makes it accessible from outside the container | |
# --no-browser prevents it from trying to open a browser inside the container | |
# --allow-root is often used in Docker environments, but it's better to run as a non-root user if possible. | |
# The `jupyter/scipy-notebook` image usually sets up a `jovyan` user, so `--allow-root` might not be necessary. | |
# If you want to set a password/token: | |
# --NotebookApp.token='your_secret_token' | |
# --NotebookApp.password='your_hashed_password' (generate with `jupyter lab password`) | |
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=7860", "--no-browser"] | |
# Optional: Copy your notebooks or data into the container if needed | |
# COPY notebooks/ /home/jovyan/work/notebooks/ | |
# COPY data/ /home/jovyan/work/data/ |