Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: draft of a minimal "developer" base image #346

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
322ac75
FROM ubuntu:20.04
sjfleming Jul 29, 2022
042759b
First working(?) version
sjfleming Aug 4, 2022
186a8b7
Attempted size minimization: 1.77GB
sjfleming Aug 5, 2022
f9f9d75
Permissions for conda installs
sjfleming Aug 5, 2022
c589165
GPU-enabled base image: 2.63 GB
sjfleming Aug 5, 2022
7cbc9d2
GPU image uses same Dockerfile; requirements files
sjfleming Aug 30, 2022
27b3541
Add documentation
sjfleming Aug 30, 2022
1877f5d
Softlink google cloud cli tools to /usr/bin
sjfleming Sep 1, 2022
f4b7b41
Combined some steps to make image marginally smaller
sjfleming Sep 6, 2022
6f39742
Important space saver: move chown commands up
sjfleming Sep 10, 2022
499e5e3
Add notes about WORKSPACE_BUCKET env var to readme
sjfleming Sep 16, 2022
eeb8519
Remove typo from README
sjfleming Sep 16, 2022
13f2191
Fix $JUPYTER_HOME permissions issue
sjfleming Sep 16, 2022
6afdba0
Improve permissions for user installs via pip and conda
sjfleming Sep 16, 2022
1859130
Merge remote-tracking branch 'upstream/master' into sf_minimal_base
sjfleming Aug 30, 2023
9339f5e
Update to python 3.10 and update package versions (#1)
sjfleming Aug 31, 2023
1c95930
Merge branch 'sf_minimal_base' of https://github.com/sjfleming/terra-…
sjfleming Aug 31, 2023
c318bca
Update readmes and changelogs
sjfleming Aug 31, 2023
f652d84
Updates to 0.0.3
sjfleming Nov 8, 2023
c8537f6
Fix conda version conflict with libmamba-solver
sjfleming Nov 8, 2023
e5584ee
Tweak order and versions
sjfleming Nov 8, 2023
8fc63f0
Testing why the solver cannot solve the env anymore
sjfleming Nov 8, 2023
6387654
Further testing to identify the issue
sjfleming Nov 8, 2023
6634679
conda-libmamba-solver was the problem, try to unpin version
sjfleming Nov 8, 2023
dab532b
Resolver found that 23.5.0 works
sjfleming Nov 8, 2023
39282a0
Bring back mamba
sjfleming Nov 8, 2023
c1119ae
Dependency issues: unpin mamba
sjfleming Nov 8, 2023
e27c4ca
Pin mamba at a compatible version
sjfleming Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GPU image uses same Dockerfile; requirements files
sjfleming committed Aug 30, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7cbc9d2fb428268adebaf9083b6d0a574466466c
3 changes: 0 additions & 3 deletions terra-jupyter-dev-base/build_docker.sh

This file was deleted.

165 changes: 0 additions & 165 deletions terra-jupyter-gpu-dev-base/Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions terra-jupyter-gpu-dev-base/build_docker.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ubuntu:20.04
ARG BASE_IMAGE="ubuntu:20.04"

FROM ${BASE_IMAGE}

USER root

@@ -8,6 +10,7 @@ USER root
# files display nicer when viewed in a terminal.
ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=en_US.UTF-8 \
GOOGLE_CLOUD_CLI_VERSION="397.0.0" \
USER=jupyter \
WELDER_USER=welder-user \
WELDER_UID=1001 \
@@ -20,7 +23,11 @@ ENV HOME=/home/$USER
# When using PIP_USER=true packages are installed into Python site.USER_BASE, which is '/home/jupyter' for this system.
# Append '/home/jupyter/.local/bin' to PATH
# pip docs: https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user
ENV PATH="${PATH}:${CONDA_DIR}/bin:${HOME}/.local/bin:${HOME}/packages/bin"
ENV PATH="${PATH}:${CONDA_DIR}/bin:${HOME}/.local/bin:${HOME}/packages/bin:${HOME}/google-cloud-sdk/bin:"

COPY requirements.txt /opt/
COPY requirements_gcc.txt /opt/
COPY gcc_pkgs.txt /opt/

# Users
RUN useradd -m -s /bin/bash $USER \
@@ -60,82 +67,44 @@ RUN useradd -m -s /bin/bash $USER \
&& locale-gen \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# install miniconda to $CONDA_DIR
# Install miniconda to $CONDA_DIR
&& curl -so $HOME/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py37_4.12.0-Linux-x86_64.sh \
&& chmod +x $HOME/miniconda.sh \
&& $HOME/miniconda.sh -b -p $CONDA_DIR \
&& rm $HOME/miniconda.sh \
# slim install of python packages that have a gcc dependency (cleanup included)
&& apt-get update && apt-get install -y --no-install-recommends \
checkinstall \
build-essential \
zlib1g-dev \
# pip requirements
libssl-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
llvm \
libncurses5-dev \
libncursesw5-dev \
tk-dev \
libffi-dev \
liblzma-dev \
python-openssl \
libexempi3 \
libv8-3.14-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install firecloud \
&& pip3 install terra-notebook-utils \
# Install gsutil with compiled crcmod
&& curl -so $HOME/google-cloud-cli.tar.gz \
https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${GOOGLE_CLOUD_CLI_VERSION}-linux-x86_64.tar.gz \
&& tar -xzf $HOME/google-cloud-cli.tar.gz -C $HOME \
&& .$HOME/google-cloud-sdk/install.sh \
&& rm $HOME/google-cloud-cli.tar.gz \
&& rm -rf ~/.cache/pip \
# Slim install of python packages that have a gcc dependency (cleanup included)
&& apt-get update && apt-get install -yq --no-install-recommends \
$(cat /opt/gcc_pkgs.txt) \
&& pip3 install -r /opt/requirements_gcc.txt \
&& apt-get purge -y --auto-remove \
checkinstall \
build-essential \
zlib1g-dev \
# pip requirements
libssl-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
llvm \
libncurses5-dev \
libncursesw5-dev \
tk-dev \
libffi-dev \
liblzma-dev \
python-openssl \
libexempi3 \
libv8-3.14-dev \
$(cat /opt/gcc_pkgs.txt) \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Install jupyter and some necessary python packages
&& pip3 -V \
# For gcloud alpha storage support.
&& pip3 install google-crc32c --target /usr/lib/google-cloud-sdk/lib/third_party \
&& git clone --branch cromshell_2.0 --single-branch \
https://github.com/broadinstitute/cromshell.git $HOME/cromshell \
# tmp hack min-5
# I'm not installing jupyterlab and I can't update init-actions.sh to not access it
&& mkdir -p /usr/local/share/jupyter/lab \
# When we upgraded from jupyter 5.7.8 to 6.1.1, we broke terminal button on terra-ui.
# Hence, make sure to manually test out "launch terminal" button (the button in the green bar next to start and stop buttons)
# to make sure we don't accidentally break it every time we upgrade notebook version until we figure out an automation test for this
&& pip3 install notebook \
&& pip3 install jupyter \
# && pip3 install jupyterlab \
&& pip3 install cookiecutter \
&& pip3 install tornado \
&& pip3 install python-datauri \
&& pip3 install jupyter_contrib_nbextensions \
&& pip3 install jupyter_nbextensions_configurator \
&& pip3 install markupsafe==2.0.1 \
# Avoid broken lower versions: https://github.com/jupyter/nbconvert/pull/1624
&& pip3 install "nbconvert>=6.4.5" \
# for jupyter_delocalize.py and jupyter_notebook_config.py
&& pip3 install requests \
&& pip3 install crcmod \
# install Cromshell 2.0, using repo cloned above
&& pip install $HOME/cromshell \
# copy workspace_cromwell.py script and make it runnable by all users
&& curl -o /usr/local/bin/workspace_cromwell.py https://raw.githubusercontent.com/broadinstitute/cromwhelm/1ceedf89587cffd355f37401b179001f029f77ed/scripts/workspace_cromwell.py \
&& chmod +x /usr/local/bin/workspace_cromwell.py
&& pip3 install -r /opt/requirements.txt \
# Copy workspace_cromwell.py script and make it runnable by all users
&& curl -o /usr/local/bin/workspace_cromwell.py \
https://raw.githubusercontent.com/broadinstitute/cromwhelm/1ceedf89587cffd355f37401b179001f029f77ed/scripts/workspace_cromwell.py \
&& chmod +x /usr/local/bin/workspace_cromwell.py \
# Cromshell 2.0
&& git clone --branch cromshell_2.0 --single-branch \
https://github.com/broadinstitute/cromshell.git $HOME/cromshell \
&& pip3 install $HOME/cromshell \
&& rm -rf ~/.cache/pip \
&& conda clean -ya

# Utilities
COPY scripts $JUPYTER_HOME/scripts
@@ -145,8 +114,7 @@ COPY jupyter_notebook_config.py $JUPYTER_HOME
RUN chown -R $USER:users $JUPYTER_HOME \
&& chown -R $USER:users $HOME/.conda \
&& chown -R $USER:users $CONDA_DIR \
# Disable nb_conda for now. Consider re-enable in the future
# && jupyter nbextension disable nb_conda --py --sys-prefix \
&& chown -R $USER:users $HOME/.config/gcloud \
&& find $JUPYTER_HOME/scripts -name '*.sh' -type f | xargs chmod +x \
# You can get kernel directory by running `jupyter kernelspec list`
&& $JUPYTER_HOME/scripts/kernel/kernelspec.sh $JUPYTER_HOME/scripts/kernel $CONDA_DIR/share/jupyter/kernels
17 changes: 17 additions & 0 deletions terra-jupyter-minimal-base/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# this copying stuff is here because there are requirements here and in ../terra-jupyter-base/
# but the build context cannot be both
cp -r ../terra-jupyter-base/custom custom
cp -r ../terra-jupyter-base/scripts scripts
cp -r ../terra-jupyter-base/jupyter_notebook_config.py jupyter_notebook_config.py

docker build -t terra-jupyter-minimal-base:0.0.1 .

rm -r custom
rm -r scripts
rm jupyter_notebook_config.py

# if requirements.txt, requirements_gcc.txt, and gcc_pkgs.txt get moved to the ../terra-jupyter-base/ folder,
# then all of the above could be replaced by this:
#docker build -t terra-jupyter-minimal-base:0.0.1 -f Dockerfile ../terra-jupyter-base/
16 changes: 16 additions & 0 deletions terra-jupyter-minimal-base/gcc_pkgs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
checkinstall
build-essential
zlib1g-dev
libssl-dev
libbz2-dev
libreadline-dev
libsqlite3-dev
llvm
libncurses5-dev
libncursesw5-dev
tk-dev
libffi-dev
liblzma-dev
python-openssl
libexempi3
libv8-3.14-dev
11 changes: 11 additions & 0 deletions terra-jupyter-minimal-base/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
notebook==6.4.12
jupyter==1.0.0
cookiecutter==2.1.1
tornado==6.2
python-datauri==1.1.0
jupyter_contrib_nbextensions==0.5.1
jupyter_nbextensions_configurator==0.5.0
markupsafe==2.0.1
nbconvert>=6.4.5
requests==2.27.1
crcmod==1.7
3 changes: 3 additions & 0 deletions terra-jupyter-minimal-base/requirements_gcc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terra-notebook-utils==0.10.0
firecloud==0.16.32.post1
crcmod==1.7
17 changes: 17 additions & 0 deletions terra-jupyter-minimal-gpu-base/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

base="nvcr.io/nvidia/cuda:11.3.1-base-ubuntu20.04"

cp -r ../terra-jupyter-base/custom ../terra-jupyter-minimal-base/custom
cp -r ../terra-jupyter-base/scripts ../terra-jupyter-minimal-base/scripts
cp -r ../terra-jupyter-base/jupyter_notebook_config.py ../terra-jupyter-minimal-base/jupyter_notebook_config.py

docker build \
-t terra-jupyter-minimal-gpu-base:0.0.1 \
-f ../terra-jupyter-minimal-base/Dockerfile \
--build-arg BASE_IMAGE=${base} \
../terra-jupyter-minimal-base/

rm -r ../terra-jupyter-minimal-base/custom
rm -r ../terra-jupyter-minimal-base/scripts
rm ../terra-jupyter-minimal-base/jupyter_notebook_config.py