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

379 minimize docker images size #380

Merged
merged 47 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9411bc1
sync versions
skoulouzis Dec 14, 2022
86e656b
change vnenv permission
skoulouzis Dec 14, 2022
75a95f2
change vnenv permission
skoulouzis Dec 15, 2022
d2904d2
remove versions
skoulouzis Dec 15, 2022
90fc580
add nbgitpuller
skoulouzis Dec 15, 2022
76a99ae
add ggshield
skoulouzis Dec 15, 2022
60d90c2
build from miniconda3-naavre
skoulouzis Dec 15, 2022
644cc52
use multistage build
skoulouzis Dec 15, 2022
ff3e99d
rename venv folder names
skoulouzis Dec 15, 2022
ac304be
use new miniconda3-pdal:v0.3
skoulouzis Dec 16, 2022
1dc2593
use correct name
skoulouzis Dec 16, 2022
7fbfef3
use correct name
skoulouzis Dec 16, 2022
1ffbbde
install merged-environment.yaml
skoulouzis Dec 17, 2022
597e5b2
install use qcdis/miniconda3-pdal:v0.4
skoulouzis Dec 17, 2022
2465a92
install use qcdis/miniconda3-pdal:v0.4
skoulouzis Dec 19, 2022
89dd6cf
Merge remote-tracking branch 'origin/main' into 379-minimize-docker-i…
skoulouzis Dec 19, 2022
feef0c4
sync with main
skoulouzis Dec 19, 2022
e88edf0
update miniconda3-naavre
skoulouzis Dec 19, 2022
e04050d
added miniconda3-multiply
skoulouzis Dec 19, 2022
a13eb7c
fix /bin/bash: line 1: jlpm: command not found
skoulouzis Dec 19, 2022
f03524b
fix /bin/bash: line 1: jlpm: command not found
skoulouzis Dec 19, 2022
c0ae65c
fix repository does not exist
skoulouzis Dec 19, 2022
4c3e4e8
build multiply
skoulouzis Dec 19, 2022
367991e
added rclone
skoulouzis Dec 19, 2022
d59b5e4
set correct name
skoulouzis Dec 19, 2022
a58831f
Successfully built multiply
skoulouzis Dec 19, 2022
ff266e6
added vol2bird
skoulouzis Dec 19, 2022
3cd1e51
added dask
skoulouzis Dec 22, 2022
a271b78
added dask
skoulouzis Dec 22, 2022
51cdced
change to ENTRYPOINT
skoulouzis Dec 22, 2022
666a11e
change script
skoulouzis Dec 23, 2022
3f807fa
Update start-jupyter-venv.sh
skoulouzis Dec 23, 2022
873f38a
build conda env from file
skoulouzis Dec 23, 2022
1f0a3f6
build conda env from file
skoulouzis Dec 23, 2022
5e10ca8
added jupyterlab_vre-0.1.0-py3-none-any.whl
skoulouzis Dec 24, 2022
f2132d7
change start script
skoulouzis Dec 24, 2022
84dac56
added jupyterhub
skoulouzis Dec 24, 2022
aeb5898
use correct image
skoulouzis Dec 25, 2022
71bee1a
added start-jupyter-venv.sh
skoulouzis Dec 27, 2022
95b02dd
build from qcdis/miniconda3-multiply
skoulouzis Dec 28, 2022
a38cb68
Merge remote-tracking branch 'origin/main' into 379-minimize-docker-i…
skoulouzis Dec 28, 2022
f7c7e99
if in pip set true to pip_package
skoulouzis Dec 29, 2022
0ab18d0
if in pip set true to pip_package
skoulouzis Dec 29, 2022
4904fc9
install lazrs-python=0.4.5
skoulouzis Dec 29, 2022
b1860a5
install lazrs-python=0.4.5
skoulouzis Dec 29, 2022
722158b
use latest
skoulouzis Dec 30, 2022
77e8c8b
use 0.5
skoulouzis Dec 30, 2022
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ install-ui:
$(call INSTALL_LAB_EXTENSION,notebook-search)
$(call INSTALL_LAB_EXTENSION,notebook-search-toolbar)
$(call INSTALL_LAB_EXTENSION,core)
$(call INSTALL_LAB_EXTENSION,notebook-containerizer)
$(call INSTALL_LAB_EXTENSION,chart-customs)
$(call INSTALL_LAB_EXTENSION,components)
$(call INSTALL_LAB_EXTENSION,experiment-manager)
Expand All @@ -51,6 +52,7 @@ link-ui:
$(call LINK_LAB_EXTENSION,notebook-search)
$(call LINK_LAB_EXTENSION,notebook-search-toolbar)
$(call LINK_LAB_EXTENSION,core)
$(call LINK_LAB_EXTENSION,notebook-containerizer)
$(call LINK_LAB_EXTENSION,chart-customs)
$(call LINK_LAB_EXTENSION,components)
$(call LINK_LAB_EXTENSION,experiment-manager)
Expand All @@ -60,6 +62,7 @@ link-ui:
dist-ui: build-frontend
mkdir -p dist
$(call PACKAGE_LAB_EXTENSION,core)
$(call PACKAGE_LAB_EXTENSION,notebook-containerizer)
$(call PACKAGE_LAB_EXTENSION,chart-customs)
$(call PACKAGE_LAB_EXTENSION,components)
$(call PACKAGE_LAB_EXTENSION,experiment-manager)
Expand Down
2 changes: 2 additions & 0 deletions docker/.condarc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
envs_dirs:
- /home/jovyan/conda-envs/
47 changes: 32 additions & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e
FROM qcdis/miniconda3-naavre AS naavre-build

RUN conda install -c conda-forge conda-pack
COPY environment.yaml .
ADD jupyterlab_vre-0.1.0-py3-none-any.whl /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl

RUN conda env update -f environment.yaml
RUN conda list
RUN conda-pack -n venv -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
RUN /venv/bin/conda-unpack

FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e AS runtime
USER root

RUN apt-get update --allow-releaseinfo-change && apt-get -y install s3fs git
RUN apt-get update --allow-releaseinfo-change && apt-get -y install fuse

COPY --from=naavre-build /venv/ /venv/

ENV PATH=/venv/bin:$PATH
ENV PATH=/home/jovyan/.local/bin:$PATH
RUN source /venv/bin/activate
RUN echo "source /venv/bin/activate" >> ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

ADD start-jupyter.sh /usr/local/bin/start-jupyter.sh
ADD jupyterlab_vre-0.1.0-py3-none-any.whl /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl
ADD start-jupyter-venv.sh /usr/local/bin/start-jupyter-venv.sh
COPY ./repo_utils/ /tmp/repo_utils

RUN chmod ugo+x /usr/local/bin/start-jupyter.sh

USER $NB_USER
COPY .condarc /tmp/.condarc

RUN conda remove --force -y terminado && \
python -m pip install --upgrade pip

RUN python3 -m pip install --quiet --no-cache-dir /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl && \
jupyter serverextension enable --py jupyterlab_vre --user
RUN chmod ugo+x /usr/local/bin/start-jupyter.sh
RUN chmod ugo+x /usr/local/bin/start-jupyter-venv.sh
RUN chown $NB_USER -R /venv/

RUN pip install jupyterlab-github jupyter-videochat nbgitpuller jupyterlab-lsp python-lsp-server[all] pre-commit ggshield && \
jupyter serverextension enable --py jupyter_videochat --user && \
jupyter serverextension enable --py jupyterlab_github --user
USER $NB_USER
RUN jupyter serverextension enable --py jupyterlab_vre --user
RUN jupyter serverextension enable --py jupyter_videochat --user
RUN jupyter serverextension enable --py jupyterlab_github --user

RUN jupyter lab build --debug;
RUN conda clean -a -y
CMD ["/usr/local/bin/start-jupyter.sh"]
cmd ["/usr/local/bin/start-jupyter-venv.sh"]
86 changes: 40 additions & 46 deletions docker/Dockerfile-MULTIPLY
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e
FROM qcdis/miniconda3-naavre AS naavre-build

RUN conda env export --name venv > naavre-build-environment.yml
RUN cat naavre-build-environment.yml


FROM qcdis/miniconda3-multiply AS naavre-pdal-build

RUN conda install -c conda-forge conda-pack
COPY --from=naavre-build naavre-build-environment.yml naavre-build-environment.yml
COPY laserfarm-environment.yaml .
ADD jupyterlab_vre-0.1.0-py3-none-any.whl /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl
RUN conda install -c conda-forge conda-merge conda-pack
RUN conda-merge naavre-build-environment.yml laserfarm-environment.yaml > merged-environment.yaml
RUN cat merged-environment.yaml
RUN conda env update -f merged-environment.yaml
RUN conda list
RUN conda-pack -n venv -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
RUN /venv/bin/conda-unpack

FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e AS runtime
USER root

#===== Add pdalpy dependencies ======
RUN apt-get update --allow-releaseinfo-change && apt-get -y install gcc g++ s3fs curl git
#====================================
RUN apt-get update --allow-releaseinfo-change && apt-get -y install fuse

#RUN apt-get -y install libblas3 libblas-dev libboost-all-dev bzip2 ca-certificates libcairo2-dev libcfitsio-dev \
# libc-ares-dev expat fontconfig libfreetype6-dev gettext giflib-tools glib-networking glib-networking-common \
# gir1.2-gst-plugins-base-1.0 libhdf4-0-alt libhdf5-dev libicu-dev libpixman-1-0 pcre2-utils nodejs lz4 \
# libopenblas-dev openssl poppler-utils poppler-data postgresql postgresql-contrib \
# libpthread-stubs0-dev sqlite3 python-tk zlib1g-dev libblas-dev libcurl4 libffi-dev \
# php-iconv libkmldom1 liblapacke llvm libnetcdf-dev krb5-user
COPY --from=naavre-pdal-build /venv/ /venv/

ENV PATH=/venv/bin:$PATH
ENV PATH=/home/jovyan/.local/bin:$PATH
RUN source /venv/bin/activate
RUN echo "source /venv/bin/activate" >> ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

ADD start-jupyter.sh /usr/local/bin/start-jupyter.sh
ADD jupyterlab_vre-0.1.0-py3-none-any.whl /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl
ADD start-jupyter-venv.sh /usr/local/bin/start-jupyter-venv.sh
COPY ./repo_utils/ /tmp/repo_utils

COPY .condarc /tmp/.condarc


RUN chmod ugo+x /usr/local/bin/start-jupyter.sh
RUN chmod ugo+x /usr/local/bin/start-jupyter-venv.sh
RUN chown $NB_USER -R /venv/

USER $NB_USER
RUN jupyter serverextension enable --py jupyterlab_vre --user
RUN jupyter serverextension enable --py jupyter_videochat --user
RUN jupyter serverextension enable --py jupyterlab_github --user

RUN conda remove --force -y terminado && \
python -m pip install --upgrade pip

RUN python3 -m pip install --quiet --no-cache-dir /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl && \
jupyter serverextension enable --py jupyterlab_vre --user


#===== Add pdalpy dependencies ======
RUN conda install --yes -c conda-forge pdal python-pdal gdal rclone && \
conda upgrade --yes numpy && \
conda update --yes -n base conda && \
pip install dask distributed lazperf==1.4.4 && \
pip install laserfarm laspy
#====================================

RUN pip install jupyterlab-github jupyter-videochat nbgitpuller jupyterlab-lsp python-lsp-server[all] pre-commit ggshield && \
jupyter serverextension enable --py jupyter_videochat --user && \
jupyter serverextension enable --py jupyterlab_github --user

COPY MULTIPLY_pip_requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN pip install git+https://github.com/JorisTimmermans/data-access.git \
git+https://github.com/JorisTimmermans/atmospheric_correction.git \
git+https://github.com/QCDIS/multiply-core.git \
git+https://github.com/QCDIS/inference-engine.git \
git+https://github.com/QCDIS/prior-engine.git \
git+https://github.com/JorisTimmermans/atmospheric_correction.git \
git+https://github.com/QCDIS/vm-support.git \
git+https://github.com/multiply-org/multiply-orchestration.git \
git+https://github.com/QCDIS/KaFKA-InferenceEngine.git \
git+https://github.com/QCDIS/BRDF_descriptors.git

WORKDIR $HOME
RUN jupyter lab build --debug;
RUN conda clean -a -y
CMD ["/usr/local/bin/start-jupyter.sh"]
cmd ["/usr/local/bin/start-jupyter-venv.sh"]
64 changes: 38 additions & 26 deletions docker/Dockerfile-laserfarm-pytorch
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e
FROM qcdis/miniconda3-naavre AS naavre-build

USER root
RUN conda env export --name venv > naavre-build-environment.yml
RUN cat naavre-build-environment.yml

#===== Add pdalpy dependencies ======
RUN apt-get update --allow-releaseinfo-change && apt-get -y install gcc g++ git
#====================================
RUN apt autoclean -y && apt autoremove -y
FROM qcdis/miniconda3-pdal:v0.5 AS naavre-pdal-build

ADD start-jupyter.sh /usr/local/bin/start-jupyter.sh
RUN conda install -c conda-forge conda-pack
COPY --from=naavre-build naavre-build-environment.yml naavre-build-environment.yml
COPY laserfarm-environment.yaml .
ADD jupyterlab_vre-0.1.0-py3-none-any.whl /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl
COPY ./repo_utils/ /tmp/repo_utils
RUN conda install -c conda-forge conda-merge conda-pack
RUN conda-merge naavre-build-environment.yml laserfarm-environment.yaml > merged-environment.yaml
RUN cat merged-environment.yaml
RUN conda env update -f merged-environment.yaml
RUN conda list
RUN conda-pack -n venv -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
RUN /venv/bin/conda-unpack

FROM jupyterhub/k8s-singleuser-sample:1.1.3-n248.h20c9028e AS runtime
USER root

RUN chmod ugo+x /usr/local/bin/start-jupyter.sh
RUN apt-get update --allow-releaseinfo-change && apt-get -y install fuse

USER $NB_USER
COPY --from=naavre-pdal-build /venv/ /venv/

RUN conda remove --force -y terminado && \
python -m pip install --upgrade pip
ENV PATH=/venv/bin:$PATH
ENV PATH=/home/jovyan/.local/bin:$PATH
RUN source /venv/bin/activate
RUN echo "source /venv/bin/activate" >> ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

RUN python -m pip install --quiet --no-cache-dir /home/jovyan/jupyterlab_vre-0.1.0-py3-none-any.whl && \
jupyter serverextension enable --py jupyterlab_vre --user
ADD start-jupyter.sh /usr/local/bin/start-jupyter.sh
ADD start-jupyter-venv.sh /usr/local/bin/start-jupyter-venv.sh
COPY ./repo_utils/ /tmp/repo_utils

COPY .condarc /tmp/.condarc

#===== Add pdalpy dependencies ======
RUN conda install --yes -c conda-forge pdal python-pdal gdal rclone && \
conda upgrade --yes numpy && \
conda update --yes -n base conda && \
pip install dask distributed lazperf==1.4.4 && \
pip install laserfarm laspy opencv-python-headless torch torchvision flwr scikit-learn tensorflow
#====================================
RUN chmod ugo+x /usr/local/bin/start-jupyter.sh
RUN chmod ugo+x /usr/local/bin/start-jupyter-venv.sh
RUN chown $NB_USER -R /venv/

RUN pip install jupyterlab-github jupyter-videochat matplotlib folium cartopy icoscp pangaeapy nbgitpuller jupyterlab-lsp python-lsp-server[all] pre-commit ggshield && \
jupyter serverextension enable --py jupyter_videochat --user && \
jupyter serverextension enable --py jupyterlab_github --user
USER $NB_USER
RUN jupyter serverextension enable --py jupyterlab_vre --user
RUN jupyter serverextension enable --py jupyter_videochat --user
RUN jupyter serverextension enable --py jupyterlab_github --user

RUN jupyter lab build --debug;

RUN conda clean -a -y
CMD ["/usr/local/bin/start-jupyter.sh"]
cmd ["/usr/local/bin/start-jupyter-venv.sh"]
Loading