Skip to content

Instantly share code, notes, and snippets.

@tabrez
Last active July 29, 2023 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tabrez/7c84f2f6d8764e33d79fbcd99050ecf5 to your computer and use it in GitHub Desktop.
Save tabrez/7c84f2f6d8764e33d79fbcd99050ecf5 to your computer and use it in GitHub Desktop.
Dockerfile to build Jupyter Lab container with fastai support
ARG OWNER=tabrez
ARG BASE_CONTAINER=jupyter/base-notebook
FROM $BASE_CONTAINER
LABEL maintainer="Tabrez Iqbal <tabrez@mailbox.org>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root
RUN apt-get update --yes \
&& apt-get install --yes --no-install-recommends \
build-essential \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
USER ${NB_UID}
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
RUN mamba install --yes -c conda-forge --freeze-installed \
numpy \
matplotlib-base \
pandas \
ipywidgets \
sentencepiece \
nbdev \
jupyterlab-autosave-on-focus-change \
nbdime \
&& mamba clean --all -f -y \
&& npm cache clean --force \
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete \
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -follow -type f -name '*.js' ! -name '*.min.js' -delete
# RUN nbdime config-git --enable --global
RUN mamba install --yes --freeze-installed \
pytorch \
torchvision \
torchaudio \
pytorch-cuda=11.7 -c pytorch -c nvidia \
&& mamba clean --all -f -y \
&& npm cache clean --force \
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete \
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -follow -type f -name '*.js' ! -name '*.min.js' -delete
RUN mamba install --yes --freeze-installed \
fastbook -c fastchan \
&& mamba clean --all -f -y \
&& npm cache clean --force \
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete \
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -follow -type f -name '*.js' ! -name '*.min.js' -delete \
# && fix-permissions "${CONDA_DIR}" \
&& fix-permissions "/home/${NB_USER}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment