Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/CUAHSI/cuahsi-model-images
Browse files Browse the repository at this point in the history
… into develop
  • Loading branch information
Castronova committed May 22, 2024
2 parents 1918da0 + 387db91 commit 2b3daec
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 43 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Manual Build from Branch

env:
GITHUB_SHA: ${{ github.sha }}
IMAGE_ROOT: singleuser
REGISTRY_HOSTNAME: docker.io
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}

on:
workflow_dispatch:
inputs:
code-branch:
description: 'Code branch to build from'
required: true
default: develop
image:
type: choice
description: 'Image Name'
required: true
default: 'base'
options:
- base
- base-py37
- base-centos7
- scientific-py3
- scientific-r
- hydrogeology-r
- waterhackweek
- geophysics
- parflow
- summa-py3
- wrfhydro
- csdms-tools
- modflow
- hl-physical-hydrology
- test
push-to-dockerhub:
description: Push to Repository
type: boolean
required: true
default: false

jobs:
build-image:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.code-branch }}

- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: ${{ env.IMAGE_ROOT }}

- name: Docker Login
run: |
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin
# Build the Docker image
- name: Echo Info
id: info
run: |
echo "Building Image for:"
echo " Branch = ${{ inputs.code-branch }}"
echo " Image = ${{ inputs.image }}"
echo ------------
echo "JH_BASE: ${{ env.JH_BASE }}"
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
echo ------------
- name: Build
run: |
cd "${IMAGE_ROOT}"
docker compose build ${{ inputs.image }}
- name: Push Docker Image
if: ${{ inputs.push-to-dockerhub }}
run: |
echo "Begin Image Tagging and Pushing"
# use BUILD_DATE in the tag
# unless we're building the 'base' image
if [ ${{ inputs.image }} == "base" ]; then
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ env.CUAHSI_BASE }}"
else
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ env.BUILD_DATE }}"
fi
export DOCKER_FULL_PATH="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ inputs.code-branch }}-latest"
echo "Old Image Name/Tag = $DOCKER_TAG"
echo "New Image Name/Tag = $DOCKER_FULL_PATH"
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
docker tag $DOCKER_TAG $DOCKER_FULL_PATH
docker push $DOCKER_FULL_PATH
echo "End Image Tagging and Pushing"
29 changes: 4 additions & 25 deletions .github/workflows/periodic-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
matrix:
IMAGE_VARIANT:
- base
- scientific
- r
- summa
- scientific-py3
- scientific-r
- summa-py3
- wrfhydro
- csdms
- csdms-tools
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -44,32 +44,11 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ${{ env.IMAGE_ROOT }}

- name: Docker Login
run: |
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin

# Build the Docker image
- name: Build
run: |
cd "${IMAGE_ROOT}"
docker compose build ${{ matrix.IMAGE_VARIANT }}
- name: Echo env configuration and set image tag
id: tagging
run: |
echo "JH_BASE: ${{ env.JH_BASE }}"
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
echo ------------
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ matrix.IMAGE_VARIANT }}:${{ env.CUAHSI_BASE }}"
export DOCKER_FULL_PATH="$DOCKER_TAG-periodic-$(date +'%Y.%m.%d')"
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
echo $DOCKER_FULL_PATH
docker tag $DOCKER_TAG $DOCKER_FULL_PATH
- name: Push Docker Image
run: |
docker push $DOCKER_FULL_PATH
# TODO: run tests?
14 changes: 9 additions & 5 deletions .github/workflows/trigger-build-on-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

on:
push:
Expand All @@ -27,11 +28,11 @@ jobs:
with:
filters: |
base: ${{ env.IMAGE_ROOT }}/base/**
scientific: ${{ env.IMAGE_ROOT }}/python3-scientific/**
r: ${{ env.IMAGE_ROOT }}/r/**
summa: ${{ env.IMAGE_ROOT }}/python3-summa/**
scientific-py3: ${{ env.IMAGE_ROOT }}/python3-scientific/**
scientific-r: ${{ env.IMAGE_ROOT }}/r/**
summa-py3: ${{ env.IMAGE_ROOT }}/python3-summa/**
wrfhydro: ${{ env.IMAGE_ROOT }}/python3-wrfhydro/**
csdms: ${{ env.IMAGE_ROOT }}/csdms-tools/**
csdms-tools: ${{ env.IMAGE_ROOT }}/csdms-tools/**
setup-build-publish-deploy:
needs: detect-changes
name: Setup, Build, and Publish
Expand Down Expand Up @@ -63,12 +64,15 @@ jobs:
- name: Echo env configuration and set image tag
id: tagging
run: |
echo "IMAGE_VARIANT: ${{ matrix.IMAGE_VARIANT }}"
echo "JH_BASE: ${{ env.JH_BASE }}"
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "BRANCH_NAME: $BRANCH_NAME"
echo ------------
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ matrix.IMAGE_VARIANT }}:${{ env.CUAHSI_BASE }}"
export DOCKER_FULL_PATH="$DOCKER_TAG-$GITHUB_SHA"
export DOCKER_FULL_PATH="${REPOSITORY}/${IMAGE_ROOT}:$BRANCH_NAME-latest"
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
echo $DOCKER_FULL_PATH
docker tag $DOCKER_TAG $DOCKER_FULL_PATH
Expand Down
26 changes: 13 additions & 13 deletions singleuser/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
###################
# Base Python 3.7 #
###################
base-py37:
base-py3.7:
env_file:
- '.env'
build:
Expand Down Expand Up @@ -64,7 +64,7 @@ services:
labels:
description: |
CUAHSI JupyterHub singleuser environment configured with scientific libraries. Built using cuahsi/jupyterhub-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-scientific-py3:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-scientific-py3:${CUAHSI_BASE}

##################
# Scientific - R #
Expand All @@ -81,7 +81,7 @@ services:
labels:
description: |
CUAHSI JupyterHub singleuser environment configured with scientific libraries with the R programming language. Built using cuahsi/jupyterhub-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-scientific-r:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-scientific-r:${CUAHSI_BASE}

##############################
# 2020 Hydrogeology Syracuse #
Expand All @@ -97,7 +97,7 @@ services:
labels:
description: |
CUAHSI JupyterHub singleuser environment configured with scientific libraries for Tao Wen's 2020 Hydrogeology course at Syracuse University. Built using cuahsi/singleuser-scientific-r:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-hydrogeology-r:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-hydrogeology-r:${CUAHSI_BASE}

######################
# 2020 WHW - Seattle #
Expand All @@ -113,7 +113,7 @@ services:
labels:
description: |
This environment is configured with scientific libraries for the 2020 Waterhackweek Cybertraining event. Built using cuahsi/singleuser-scientific-py3:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-waterhackweek:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-waterhackweek:${CUAHSI_BASE}

################################
# 2018 Near Surface Geophysics #
Expand All @@ -130,7 +130,7 @@ services:
labels:
description: |
CUAHSI JupyterHub singleuser environment configured for the 2019 Near Surface Geophysics Workshop. This image uses WINE to run R2, gmsh,and pyres. Built using cuahsi/singleuser-scientific-py3:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-geophysics:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-geophysics:${CUAHSI_BASE}


####################
Expand Down Expand Up @@ -165,7 +165,7 @@ services:
labels:
description: |
Environment configured for Parflow. Built using cuahsi/singleuser-base:centos7.v${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-parflow:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-parflow:${CUAHSI_BASE}

#########
# SUMMA #
Expand All @@ -182,7 +182,7 @@ services:
labels:
description: |
Environment configured for SUMMA. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-summa-py3:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-summa-py3:${CUAHSI_BASE}

###############
# CSDMS TOOLS #
Expand All @@ -199,7 +199,7 @@ services:
labels:
description: |
Environment configured for the Community Surface Dynamics Modeling System. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-csdms-tools:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-csdms-tools:${CUAHSI_BASE}

#############
# WRF-Hydro #
Expand All @@ -220,7 +220,7 @@ services:
labels:
description: |
Environment configured for the NCAR WRF-Hydro model (nwm v2.0). Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-wrfhydro:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-wrfhydro:${CUAHSI_BASE}

#############
# SI-2021 #
Expand All @@ -237,7 +237,7 @@ services:
labels:
description: |
Environment configured for the 2021 SI. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-si2021:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-si2021:${CUAHSI_BASE}

#############
# MODFLOW #
Expand All @@ -254,7 +254,7 @@ services:
labels:
description: |
Environment configured to run MODFLOW for the 2021 IAH conference. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
image: ${REPOSITORY}/singleuser-modflow:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-modflow:${CUAHSI_BASE}

###################
# EDU - Gerbrand #
Expand All @@ -268,7 +268,7 @@ services:
args:
# image version to use as base
BASE_VERSION: ${CUAHSI_BASE}
image: cuahsi/singleuser-edu:${BUILD_DATE}
image: ${REPOSITORY}/singleuser-edu:${CUAHSI_BASE}

####################################
# HydroLearn - Physical Hydrology #
Expand Down

0 comments on commit 2b3daec

Please sign in to comment.