diff --git a/.github/workflows/docker-image-coastwatch_patch.yml b/.github/workflows/docker-image-coastwatch_patch.yml new file mode 100644 index 0000000..80bebd4 --- /dev/null +++ b/.github/workflows/docker-image-coastwatch_patch.yml @@ -0,0 +1,30 @@ +name: Docker Image CI coastwatch patch +on: + workflow_dispatch: null + push: + branches: coastwatch-patch + paths: + - 'images/coastwatch/**' + - '.github/workflows/docker-image-coastwatch_patch.yml' +jobs: + build: + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + if: github.repository == 'nmfs-opensci/container-images' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Build the Docker image + if: github.repository == 'nmfs-opensci/container-images' + run: | + docker build images/coastwatch -f images/coastwatch/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/coastwatch-patch:latest + - name: Publish + if: github.repository == 'nmfs-opensci/container-images' + run: | + docker push ghcr.io/nmfs-opensci/container-images/coastwatch-patch:latest + diff --git a/images/coastwatch/Dockerfile b/images/coastwatch/Dockerfile index 2c090ed..d5c96f3 100644 --- a/images/coastwatch/Dockerfile +++ b/images/coastwatch/Dockerfile @@ -1,47 +1,18 @@ -# devcontainer-focused Rocker -# FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3 -FROM rocker/geospatial:4.2 -# switch user to jovyan; later not working -#RUN usermod -l rstudio jovyan - -# some Git preferences -RUN git config --system pull.rebase false && \ - git config --system credential.helper 'cache --timeout=36000' - -# Set up conda -ENV NB_USER=rstudio -ENV CONDA_ENV=/opt/miniforge3 -ENV PATH=${CONDA_ENV}/bin:${PATH} -RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \ - bash Miniforge3-$(uname)-$(uname -m).sh -b -p ${CONDA_ENV} && \ - chown ${NB_USER}:staff -R ${CONDA_ENV} && \ - rm -f Miniforge3*.sh *.deb - +FROM openscapes/rocker:a7596b5 +# Make sure R uses the conda path +USER root RUN echo "PATH=${PATH}" >>"${R_HOME}/etc/Renviron.site" -# Initialize conda by default for all users: -RUN conda init --system - -# Standard user setup here -RUN usermod -d /home/jovyan rstudio -USER ${NB_USER} -WORKDIR /home/jovyan -RUN usermod -s /bin/bash ${NB_USER} +USER ${NB_USER} +WORKDIR ${HOME} -# install into the default environment +# install into the coastwatch packages if missing environment COPY install.R install.R RUN Rscript install.R && rm install.R # set-up the base coastwatch environment -# make sure we install in the base environment +# make sure we install in the notebook environment which is default in the +# Openscapes image COPY coastwatch-environment.yml coastwatch-environment.yml -RUN conda env update --name base -f coastwatch-environment.yml && conda clean --all +RUN mamba env update --name notebook -f coastwatch-environment.yml && mamba clean --all RUN rm coastwatch-environment.yml - -# add the packages needed for jupyterhubs -# need the --name part so that this is put in the coastwatch env -COPY jhub-environment.yml jhub-environment.yml -RUN conda env update --name base -f jhub-environment.yml && conda clean --all -RUN rm jhub-environment.yml - - diff --git a/images/coastwatch/install.R b/images/coastwatch/install.R index 4319b68..4d17165 100755 --- a/images/coastwatch/install.R +++ b/images/coastwatch/install.R @@ -1,10 +1,13 @@ #! /usr/local/bin/Rscript # install R dependencies -list.of.packages <- c("ncdf4", "httr","plyr","lubridate", "parsedate", "rerddap","plotdap", - "rerddapXtracto", "graphics", "maps", "mapdata","RColorBrewer", - "ggplot2","scales","dplyr","utils","Rcurl","raster","colorRamps", - "parsedate","sp","sf","reshape2","jsonlite","rgdal", - "gridGraphics","grid","PBSmapping","date","viridis", - "openair","cmocean", "terra") -install.packages(list.of.packages) \ No newline at end of file +# to match rocker/geospatial:4.2 uses in openscapes/rocker:a7596b5 +repo <- "https://p3m.dev/cran/__linux__/jammy/2023-04-20" +list.of.packages <- c("ncdf4", "httr", "plyr", "lubridate", "parsedate", "rerddap", + "maps", "mapdata", "RColorBrewer", + "ggplot2","scales", "dplyr", "RCurl", "raster", "colorRamps", + "parsedate", "sp", "sf", "reshape2", "jsonlite", + "gridGraphics", "PBSmapping", "date", "viridis", + "openair","cmocean", "terra", + "plotdap", "rerddapXtracto", "rgdal") +install.packages(list.of.packages, repos=repo)