From ed4d19af83fc52eaa7ffff20d79166081f8159f2 Mon Sep 17 00:00:00 2001 From: Carl Date: Mon, 12 Feb 2024 15:55:56 -0800 Subject: [PATCH] update libs --- images/Dockerfile | 28 ++++++++++++++++++---------- images/Dockerfile.gpu | 31 ++++++++++++++++--------------- images/apt.txt | 5 +++++ images/install.R | 17 +++++++++++------ images/rl-requirements.txt | 1 + images/spatial_install.R | 20 ++++++++++++++++++++ 6 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 images/apt.txt create mode 100755 images/spatial_install.R diff --git a/images/Dockerfile b/images/Dockerfile index d64792a..b169c01 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -9,25 +9,33 @@ RUN /rocker_scripts/install_jupyter.sh RUN /rocker_scripts/experimental/install_dev_osgeo.sh RUN chown -R rstudio:staff ${VIRTUAL_ENV} && chmod -R g+rw ${VIRTUAL_ENV} -COPY install.R /tmp/install.R -COPY jupyter-requirements.txt /tmp/jupyter-requirements.txt -COPY spatial-requirements.txt /tmp/spatial-requirements.txt -COPY rl-requirements.txt /tmp/rl-requirements.txt +# install codeserver +RUN curl -fsSL https://code-server.dev/install.sh | sh && rm -rf .cache +COPY apt.txt apt.txt +RUN apt-get update -qq && xargs sudo apt-get -y install < apt.txt + +COPY install.R /tmp/install.R RUN Rscript /tmp/install.R + +# some git preferences +RUN git config --system pull.rebase false && \ + git config --system credential.helper 'cache --timeout=30000' + + USER ${NB_USER} WORKDIR /home/${NB_USER} RUN usermod -s /bin/bash ${NB_USER} -RUN python3 -m pip install -r /tmp/jupyter-requirements.txt -RUN python3 -m pip install -r /tmp/spatial-requirements.txt -RUN python3 -m pip install -r /tmp/rl-requirements.txt +COPY jupyter-requirements.txt /tmp/jupyter-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/jupyter-requirements.txt +COPY spatial-requirements.txt /tmp/spatial-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/spatial-requirements.txt +COPY rl-requirements.txt /tmp/rl-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/rl-requirements.txt ## no need to register the environment #RUN python3 -m ipykernel install --user --name=spatial -# some git preferences -RUN git config --global pull.rebase false && \ - git config --global credential.helper 'cache --timeout=30000' diff --git a/images/Dockerfile.gpu b/images/Dockerfile.gpu index d8adb8c..2914c96 100644 --- a/images/Dockerfile.gpu +++ b/images/Dockerfile.gpu @@ -4,34 +4,35 @@ ENV NB_USER rstudio ENV VIRTUAL_ENV /opt/venv ENV PATH ${VIRTUAL_ENV}/bin:$PATH - RUN /rocker_scripts/install_jupyter.sh RUN chown -R ${NB_USER}:staff ${VIRTUAL_ENV} && chmod -R g+rw ${VIRTUAL_ENV} # install codeserver -RUN curl -fsSL https://code-server.dev/install.sh | sh +RUN curl -fsSL https://code-server.dev/install.sh | sh && rm -rf .cache -COPY install.R /tmp/install.R -COPY jupyter-requirements.txt /tmp/jupyter-requirements.txt -COPY spatial-requirements.txt /tmp/spatial-requirements.txt -COPY rl-requirements.txt /tmp/rl-requirements.txt +RUN /rocker_scripts/experimental/install_dev_osgeo.sh -RUN Rscript /tmp/install.R +COPY apt.txt apt.txt +RUN apt-get update -qq && xargs sudo apt-get -y install < apt.txt -RUN apt-get update -qq && apt-get -y install vim +COPY install.R /tmp/install.R +RUN Rscript /tmp/install.R && rm /tmp/install.R + +# some git preferences +RUN git config --system pull.rebase false && \ + git config --system credential.helper 'cache --timeout=30000' USER ${NB_USER} WORKDIR /home/${NB_USER} RUN usermod -s /bin/bash ${NB_USER} -RUN python3 -m pip install -r /tmp/jupyter-requirements.txt -RUN python3 -m pip install -r /tmp/spatial-requirements.txt -RUN python3 -m pip install -r /tmp/rl-requirements.txt +COPY jupyter-requirements.txt /tmp/jupyter-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/jupyter-requirements.txt +COPY spatial-requirements.txt /tmp/spatial-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/spatial-requirements.txt +COPY rl-requirements.txt /tmp/rl-requirements.txt +RUN python3 -m pip install --no-cache-dir -r /tmp/rl-requirements.txt ## no need to register the environment #RUN python3 -m ipykernel install --user --name=spatial -# some git preferences -RUN git config --global pull.rebase false && \ - git config --global credential.helper 'cache --timeout=30000' - diff --git a/images/apt.txt b/images/apt.txt new file mode 100644 index 0000000..c09ae14 --- /dev/null +++ b/images/apt.txt @@ -0,0 +1,5 @@ +vim +cmake +nano +exuberant-ctags + diff --git a/images/install.R b/images/install.R index d8e6c39..77f63e7 100755 --- a/images/install.R +++ b/images/install.R @@ -1,16 +1,21 @@ #! /usr/local/bin/Rscript # install R dependencies +## Ensure spatial packages are installed from source # We could use renv.lock approach here instead, but will force re-creation of environment from scratch # Does not provide a good way to ensure that sf/terra/gdalcubes are installed from source while other packages can be binary # Likewise, pak insists on installing old gdal from apt instead of respecting system library source builds -# install.packages("pak") -install.packages(c("rstac", "spData", "earthdatalogin", "quarto", "aws.s3", "tmap", "pak")) -remotes::install_github('r-tmap/tmap') +install.packages("pak") +pak::pkg_install(c("rstac", "spData", "earthdatalogin", "quarto", "aws.s3", "pak", "duckdbfs", "minioclient")) +pak::pkg_install("r-tmap/tmap") + +#remotes::install_github('r-tmap/tmap', upgrade="never", repos="https://cloud.r-project.org", dep=TRUE) + pak::pkg_install("igraph") +pak::pkg_install("ropensci-review-tools/pkgcheck") -#pak::pkg_install("httpgd") -#pak::pkg_install(c("IRkernel", "languageserver")) -#IRkernel::installspec() +# pak::pkg_install("httpgd") +pak::pkg_install(c("IRkernel", "languageserver")) +IRkernel::installspec() diff --git a/images/rl-requirements.txt b/images/rl-requirements.txt index 08e16be..d934f0e 100644 --- a/images/rl-requirements.txt +++ b/images/rl-requirements.txt @@ -9,4 +9,5 @@ ray[rllib,tune] stable-baselines3 sb3-contrib huggingface_sb3 +darts[all] diff --git a/images/spatial_install.R b/images/spatial_install.R new file mode 100755 index 0000000..77da830 --- /dev/null +++ b/images/spatial_install.R @@ -0,0 +1,20 @@ +#! /usr/local/bin/Rscript +# install R dependencies + +## Ensure spatial packages are installed from source +Sys.setenv(GITHUB_PAT="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") +remotes::install_github('r-tmap/tmap', upgrade="never", repos="https://cloud.r-project.org", dep=TRUE) + +# We could use renv.lock approach here instead, but will force re-creation of environment from scratch +# Does not provide a good way to ensure that sf/terra/gdalcubes are installed from source while other packages can be binary +# Likewise, pak insists on installing old gdal from apt instead of respecting system library source builds +install.packages("pak") +pak::pkg_install(c("rstac", "spData", "earthdatalogin", "quarto", "aws.s3", "pak", "duckdbfs", "minioclient")) + +pak::pkg_install("igraph") +pak::pkg_install("ropensci-review-tools/pkgcheck") + +pak::pkg_install("httpgd") +pak::pkg_install(c("IRkernel", "languageserver")) +IRkernel::installspec() +