Skip to content

Instantly share code, notes, and snippets.

@manthey
Created August 27, 2018 18:29
Show Gist options
  • Save manthey/3fd17ce76ef01243b976137570cd6628 to your computer and use it in GitHub Desktop.
Save manthey/3fd17ce76ef01243b976137570cd6628 to your computer and use it in GitHub Desktop.
Minimal Ubuntu 18.04 Dockerfile to run Jupyter examples for HistomicsTK
FROM ubuntu:18.04
# Prerequisites and runtimes
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
build-essential \
git \
python-dev \
python-pip \
python-setuptools \
python-wheel \
sudo \
# These are optional, but large_image doesn't do as much without them
libtiff5 \
openslide-tools \
# Some of our Jupyter examples use curl
curl
RUN adduser --disabled-password --gecos '' ubuntu && \
adduser ubuntu sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER ubuntu
WORKDIR /home/ubuntu
# Make a bin directory so that cmake will install without sudo
RUN mkdir -p /home/ubuntu/.local/bin
ENV PATH "/home/ubuntu/.local/bin:$PATH"
RUN pip install numpy
RUN git clone https://github.com/girder/large_image.git && \
cd large_image && \
# We could also add memcached and mapnik, but they have other dependencies
pip install .[openslide]
RUN git clone https://github.com/DigitalSlideArchive/HistomicsTK.git && \
cd HistomicsTK && \
# We need scikit-build to pip install HistomicsTK. This works:
# pip install --no-cache-dir -r requirements.txt && \
# but this is sufficient:
pip install scikit-build && \
pip install -e .
# Install Jupyter and configure it to run with any IP
RUN pip install jupyter && \
mkdir ~/.jupyter && \
echo 'c.NotebookApp.allow_origin = "*"\n\
c.NotebookApp.ip = "0.0.0.0"\n\
c.NotebookApp.open_browser = False\n'\
> ~/.jupyter/jupyter_notebook_config.py
# Expose the Jupyter port
EXPOSE 8888
# Switch to the notebook examples directory
WORKDIR /home/ubuntu/HistomicsTK/docs/examples
# Run the notebook examples
CMD jupyter notebook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment