Skip to content

Commit 2b3daec

Browse files
committed
Merge branch 'develop' of https://github.com/CUAHSI/cuahsi-model-images into develop
2 parents 1918da0 + 387db91 commit 2b3daec

File tree

4 files changed

+130
-43
lines changed

4 files changed

+130
-43
lines changed

.github/workflows/manual-build.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Manual Build from Branch
2+
3+
env:
4+
GITHUB_SHA: ${{ github.sha }}
5+
IMAGE_ROOT: singleuser
6+
REGISTRY_HOSTNAME: docker.io
7+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
8+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
9+
REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
code-branch:
15+
description: 'Code branch to build from'
16+
required: true
17+
default: develop
18+
image:
19+
type: choice
20+
description: 'Image Name'
21+
required: true
22+
default: 'base'
23+
options:
24+
- base
25+
- base-py37
26+
- base-centos7
27+
- scientific-py3
28+
- scientific-r
29+
- hydrogeology-r
30+
- waterhackweek
31+
- geophysics
32+
- parflow
33+
- summa-py3
34+
- wrfhydro
35+
- csdms-tools
36+
- modflow
37+
- hl-physical-hydrology
38+
- test
39+
push-to-dockerhub:
40+
description: Push to Repository
41+
type: boolean
42+
required: true
43+
default: false
44+
45+
jobs:
46+
build-image:
47+
runs-on: ubuntu-latest
48+
continue-on-error: true
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v2
52+
with:
53+
ref: ${{ inputs.code-branch }}
54+
55+
- name: Load .env file
56+
uses: xom9ikk/dotenv@v2
57+
with:
58+
path: ${{ env.IMAGE_ROOT }}
59+
60+
- name: Docker Login
61+
run: |
62+
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin
63+
64+
# Build the Docker image
65+
- name: Echo Info
66+
id: info
67+
run: |
68+
echo "Building Image for:"
69+
echo " Branch = ${{ inputs.code-branch }}"
70+
echo " Image = ${{ inputs.image }}"
71+
echo ------------
72+
echo "JH_BASE: ${{ env.JH_BASE }}"
73+
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
74+
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
75+
echo ------------
76+
- name: Build
77+
run: |
78+
cd "${IMAGE_ROOT}"
79+
docker compose build ${{ inputs.image }}
80+
- name: Push Docker Image
81+
if: ${{ inputs.push-to-dockerhub }}
82+
run: |
83+
echo "Begin Image Tagging and Pushing"
84+
85+
# use BUILD_DATE in the tag
86+
# unless we're building the 'base' image
87+
if [ ${{ inputs.image }} == "base" ]; then
88+
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ env.CUAHSI_BASE }}"
89+
else
90+
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ env.BUILD_DATE }}"
91+
fi
92+
93+
export DOCKER_FULL_PATH="${REPOSITORY}/${IMAGE_ROOT}-${{ inputs.image }}:${{ inputs.code-branch }}-latest"
94+
echo "Old Image Name/Tag = $DOCKER_TAG"
95+
echo "New Image Name/Tag = $DOCKER_FULL_PATH"
96+
97+
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
98+
99+
100+
docker tag $DOCKER_TAG $DOCKER_FULL_PATH
101+
docker push $DOCKER_FULL_PATH
102+
103+
echo "End Image Tagging and Pushing"
104+

.github/workflows/periodic-image-build.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
matrix:
2525
IMAGE_VARIANT:
2626
- base
27-
- scientific
28-
- r
29-
- summa
27+
- scientific-py3
28+
- scientific-r
29+
- summa-py3
3030
- wrfhydro
31-
- csdms
31+
- csdms-tools
3232
steps:
3333
- name: Checkout
3434
uses: actions/checkout@v2
@@ -44,32 +44,11 @@ jobs:
4444
uses: xom9ikk/dotenv@v2
4545
with:
4646
path: ${{ env.IMAGE_ROOT }}
47-
48-
- name: Docker Login
49-
run: |
50-
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin
5147

5248
# Build the Docker image
5349
- name: Build
5450
run: |
5551
cd "${IMAGE_ROOT}"
5652
docker compose build ${{ matrix.IMAGE_VARIANT }}
57-
58-
- name: Echo env configuration and set image tag
59-
id: tagging
60-
run: |
61-
echo "JH_BASE: ${{ env.JH_BASE }}"
62-
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
63-
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
64-
echo ------------
65-
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ matrix.IMAGE_VARIANT }}:${{ env.CUAHSI_BASE }}"
66-
export DOCKER_FULL_PATH="$DOCKER_TAG-periodic-$(date +'%Y.%m.%d')"
67-
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
68-
echo $DOCKER_FULL_PATH
69-
docker tag $DOCKER_TAG $DOCKER_FULL_PATH
70-
71-
- name: Push Docker Image
72-
run: |
73-
docker push $DOCKER_FULL_PATH
7453
7554
# TODO: run tests?

.github/workflows/trigger-build-on-changes.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ env:
77
DOCKER_USER: ${{ secrets.DOCKER_USER }}
88
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
99
REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
10+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1011

1112
on:
1213
push:
@@ -27,11 +28,11 @@ jobs:
2728
with:
2829
filters: |
2930
base: ${{ env.IMAGE_ROOT }}/base/**
30-
scientific: ${{ env.IMAGE_ROOT }}/python3-scientific/**
31-
r: ${{ env.IMAGE_ROOT }}/r/**
32-
summa: ${{ env.IMAGE_ROOT }}/python3-summa/**
31+
scientific-py3: ${{ env.IMAGE_ROOT }}/python3-scientific/**
32+
scientific-r: ${{ env.IMAGE_ROOT }}/r/**
33+
summa-py3: ${{ env.IMAGE_ROOT }}/python3-summa/**
3334
wrfhydro: ${{ env.IMAGE_ROOT }}/python3-wrfhydro/**
34-
csdms: ${{ env.IMAGE_ROOT }}/csdms-tools/**
35+
csdms-tools: ${{ env.IMAGE_ROOT }}/csdms-tools/**
3536
setup-build-publish-deploy:
3637
needs: detect-changes
3738
name: Setup, Build, and Publish
@@ -63,12 +64,15 @@ jobs:
6364
- name: Echo env configuration and set image tag
6465
id: tagging
6566
run: |
67+
echo "IMAGE_VARIANT: ${{ matrix.IMAGE_VARIANT }}"
6668
echo "JH_BASE: ${{ env.JH_BASE }}"
6769
echo "CUAHSI_BASE: ${{ env.CUAHSI_BASE }}"
6870
echo "BUILD_DATE: ${{ env.BUILD_DATE }}"
71+
echo "GITHUB_SHA: $GITHUB_SHA"
72+
echo "BRANCH_NAME: $BRANCH_NAME"
6973
echo ------------
7074
export DOCKER_TAG="${REPOSITORY}/${IMAGE_ROOT}-${{ matrix.IMAGE_VARIANT }}:${{ env.CUAHSI_BASE }}"
71-
export DOCKER_FULL_PATH="$DOCKER_TAG-$GITHUB_SHA"
75+
export DOCKER_FULL_PATH="${REPOSITORY}/${IMAGE_ROOT}:$BRANCH_NAME-latest"
7276
echo "DOCKER_FULL_PATH=$DOCKER_FULL_PATH" >> $GITHUB_ENV
7377
echo $DOCKER_FULL_PATH
7478
docker tag $DOCKER_TAG $DOCKER_FULL_PATH

singleuser/docker-compose.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
###################
2222
# Base Python 3.7 #
2323
###################
24-
base-py37:
24+
base-py3.7:
2525
env_file:
2626
- '.env'
2727
build:
@@ -64,7 +64,7 @@ services:
6464
labels:
6565
description: |
6666
CUAHSI JupyterHub singleuser environment configured with scientific libraries. Built using cuahsi/jupyterhub-base:${CUAHSI_BASE} on ${BUILD_DATE}.
67-
image: ${REPOSITORY}/singleuser-scientific-py3:${BUILD_DATE}
67+
image: ${REPOSITORY}/singleuser-scientific-py3:${CUAHSI_BASE}
6868

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

8686
##############################
8787
# 2020 Hydrogeology Syracuse #
@@ -97,7 +97,7 @@ services:
9797
labels:
9898
description: |
9999
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}.
100-
image: ${REPOSITORY}/singleuser-hydrogeology-r:${BUILD_DATE}
100+
image: ${REPOSITORY}/singleuser-hydrogeology-r:${CUAHSI_BASE}
101101

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

118118
################################
119119
# 2018 Near Surface Geophysics #
@@ -130,7 +130,7 @@ services:
130130
labels:
131131
description: |
132132
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}.
133-
image: ${REPOSITORY}/singleuser-geophysics:${BUILD_DATE}
133+
image: ${REPOSITORY}/singleuser-geophysics:${CUAHSI_BASE}
134134

135135

136136
####################
@@ -165,7 +165,7 @@ services:
165165
labels:
166166
description: |
167167
Environment configured for Parflow. Built using cuahsi/singleuser-base:centos7.v${CUAHSI_BASE} on ${BUILD_DATE}.
168-
image: ${REPOSITORY}/singleuser-parflow:${BUILD_DATE}
168+
image: ${REPOSITORY}/singleuser-parflow:${CUAHSI_BASE}
169169

170170
#########
171171
# SUMMA #
@@ -182,7 +182,7 @@ services:
182182
labels:
183183
description: |
184184
Environment configured for SUMMA. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
185-
image: ${REPOSITORY}/singleuser-summa-py3:${BUILD_DATE}
185+
image: ${REPOSITORY}/singleuser-summa-py3:${CUAHSI_BASE}
186186

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

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

225225
#############
226226
# SI-2021 #
@@ -237,7 +237,7 @@ services:
237237
labels:
238238
description: |
239239
Environment configured for the 2021 SI. Built using cuahsi/singleuser-base:${CUAHSI_BASE} on ${BUILD_DATE}.
240-
image: ${REPOSITORY}/singleuser-si2021:${BUILD_DATE}
240+
image: ${REPOSITORY}/singleuser-si2021:${CUAHSI_BASE}
241241

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

259259
###################
260260
# EDU - Gerbrand #
@@ -268,7 +268,7 @@ services:
268268
args:
269269
# image version to use as base
270270
BASE_VERSION: ${CUAHSI_BASE}
271-
image: cuahsi/singleuser-edu:${BUILD_DATE}
271+
image: ${REPOSITORY}/singleuser-edu:${CUAHSI_BASE}
272272

273273
####################################
274274
# HydroLearn - Physical Hydrology #

0 commit comments

Comments
 (0)