mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 07:23:00 +00:00
Merge pull request #2840 from minrk/dockerfile-simplify
simplify Dockerfile
This commit is contained in:
106
Dockerfile
106
Dockerfile
@@ -22,78 +22,76 @@
|
||||
# from your docker directory.
|
||||
|
||||
# https://github.com/tianon/docker-brew-ubuntu-core/commit/3c462555392cb188830b7c91e29311b5fad90cfe
|
||||
ARG BASE_CONTAINER=ubuntu:bionic-20190612@sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c
|
||||
FROM $BASE_CONTAINER
|
||||
|
||||
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
|
||||
ARG BASE_IMAGE=ubuntu:bionic-20190612@sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
USER root
|
||||
|
||||
# Install all OS dependencies for notebook server that starts but lacks all
|
||||
# features (e.g., download as all possible file formats)
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq --no-install-recommends \
|
||||
wget \
|
||||
bzip2 \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -yq --no-install-recommends \
|
||||
ca-certificates \
|
||||
sudo \
|
||||
locales \
|
||||
fonts-liberation \
|
||||
run-one && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
python3-pycurl \
|
||||
nodejs \
|
||||
npm \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Configure environment
|
||||
ENV CONDA_DIR=/opt/conda \
|
||||
SHELL=/bin/bash \
|
||||
# copy only what we need to avoid unnecessary rebuilds
|
||||
COPY README.md setup.py requirements.txt pyproject.toml package.json /src/jupyterhub/
|
||||
COPY jupyterhub/ /src/jupyterhub/jupyterhub
|
||||
COPY share/ /src/jupyterhub/share
|
||||
|
||||
WORKDIR /src/jupyterhub
|
||||
RUN python3 -m pip install --upgrade setuptools pip wheel
|
||||
RUN python3 -m pip wheel -v --wheel-dir wheelhouse .
|
||||
|
||||
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
USER root
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -yq --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
locales \
|
||||
python3-pip \
|
||||
python3-pycurl \
|
||||
nodejs \
|
||||
npm \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV SHELL=/bin/bash \
|
||||
LC_ALL=en_US.UTF-8 \
|
||||
LANG=en_US.UTF-8 \
|
||||
LANGUAGE=en_US.UTF-8 \
|
||||
MINICONDA_VERSION=4.7.10 \
|
||||
MINICONDA_MD5=1c945f2b3335c7b2b15130b1b2dc5cf4 \
|
||||
CONDA_VERSION=4.7.12
|
||||
ENV PATH=$CONDA_DIR/bin:$PATH
|
||||
LANGUAGE=en_US.UTF-8
|
||||
|
||||
# Install Conda and Miniconda
|
||||
RUN cd /tmp && \
|
||||
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \
|
||||
echo "${MINICONDA_MD5} *Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \
|
||||
/bin/bash Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
|
||||
rm Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \
|
||||
echo "conda ${CONDA_VERSION}" >> $CONDA_DIR/conda-meta/pinned && \
|
||||
$CONDA_DIR/bin/conda config --system --prepend channels conda-forge && \
|
||||
$CONDA_DIR/bin/conda config --system --set auto_update_conda false && \
|
||||
$CONDA_DIR/bin/conda config --system --set show_channel_urls true && \
|
||||
$CONDA_DIR/bin/conda install --quiet --yes conda && \
|
||||
$CONDA_DIR/bin/conda update --all --quiet --yes && \
|
||||
conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \
|
||||
conda clean --all -f -y
|
||||
RUN locale-gen $LC_ALL
|
||||
|
||||
# Install python and nodejs packages
|
||||
RUN conda install --yes -c conda-forge \
|
||||
configurable-http-proxy \
|
||||
jinja2 \
|
||||
nodejs \
|
||||
pip \
|
||||
pycurl \
|
||||
python=3.6 \
|
||||
requests \
|
||||
sqlalchemy \
|
||||
tornado \
|
||||
traitlets && \
|
||||
conda clean --all -f -y
|
||||
# always make sure pip is up to date!
|
||||
RUN python3 -m pip install --no-cache --upgrade setuptools pip
|
||||
|
||||
COPY . /src/jupyterhub
|
||||
WORKDIR /src/jupyterhub
|
||||
RUN npm install -g configurable-http-proxy@^4.2.0 \
|
||||
&& rm -rf ~/.npm
|
||||
|
||||
RUN pip install . && \
|
||||
rm -rf $PWD ~/.cache ~/.npm
|
||||
# install the wheels we built in the first stage
|
||||
COPY --from=0 /src/jupyterhub/wheelhouse /tmp/wheelhouse
|
||||
RUN python3 -m pip install --no-cache /tmp/wheelhouse/*
|
||||
|
||||
RUN mkdir -p /srv/jupyterhub/
|
||||
WORKDIR /srv/jupyterhub/
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
|
||||
LABEL org.jupyter.service="jupyterhub"
|
||||
|
||||
CMD ["jupyterhub"]
|
||||
|
Reference in New Issue
Block a user