Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
eeholmes committed Mar 24, 2024
2 parents aec6013 + d3835b4 commit d2c8d7b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 44 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docker-image-coastwatch_patch.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 9 additions & 37 deletions images/coastwatch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
# devcontainer-focused Rocker
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3
# 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


17 changes: 10 additions & 7 deletions images/coastwatch/install.R
Original file line number Diff line number Diff line change
@@ -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)
# 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)

0 comments on commit d2c8d7b

Please sign in to comment.