Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# .github/workflows/docker-build.yml
name: build

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 2 * * 1' # Every day at 2 AM UTC

jobs:
docker-build:
name: Build dev/latest Dockerfile
name: Build Dockerfiles
if: github.repository == 'NCAR/wrf_hydro_docker'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Build base Docker image
run: |
docker build -t wrfhydro/dev:base dev/base

- name: Build release Docker image
run: |
docker build -t wrfhydro/dev:release dev/release

- name: Build latest Docker image
run: |
docker build -t wrfhydro/dev:latest dev/latest
8 changes: 6 additions & 2 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: docker

on:
workflow_dispatch:
push:
branches:
# Only build containers when pushing to main
Expand All @@ -9,6 +10,7 @@ on:
env:
BASE_TAG: wrfhydro/dev:base
LATEST_TAG: wrfhydro/dev:latest
RELEASE_TAG: wrfhydro/dev:v5.4.0

jobs:
docker:
Expand All @@ -17,25 +19,27 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Check if secrets are defined
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ]; then echo "Username is MISSING"; else echo "Username is SET"; fi
if [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then echo "Token is MISSING"; else echo "Token is SET"; fi

- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker image
run: |
docker build -t ${{ env.BASE_TAG}} dev/base
docker build -t ${{ env.RELEASE_TAG}} dev/release
docker build -t ${{ env.LATEST_TAG}} dev/latest

- name: Push Docker image
run: |
docker push ${{ env.BASE_TAG }}
docker push ${{ env.RELEASE_TAG }}
docker push ${{ env.LATEST_TAG }}
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
docker_dirs:=dev/base dev/release dev/latest
deploy_dirs:=$(addprefix deploy-,$(docker_dirs))

all: build

build: docker
build-base: dev/base
build-release: dev/release
build-latest: dev/latest

docker: $(docker_dirs)
$(docker_dirs):
@echo "Entering directory $@"
make -C $@ build

deploy: $(deploy_dirs)
$(deploy_dirs):
dir=$(@:deploy-%=%); \
echo "Entering directory $$dir"; \
make -C $$dir deploy

run: run-latest
run-base:
@cd dev/base && make run
run-latest:
@cd dev/latest && make run
run-release:
@cd dev/release && make run

list:
docker images
@echo ""
docker ps -a

clean:
containers=$$(docker ps -aq); \
if [ -n "$$containers" ]; then \
docker rm $$containers; \
fi
docker images --format '{{.ID}}' wrfhydro/dev | \
sort -u | \
xargs -r docker rmi -f

.PHONY: all build $(docker_dirs) deploy $(deploy_dirs)
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,36 @@ Large datasets are sometimes required and are avilable on a public Google Drive
Each subdirectory in this repository corresponds to a Docker image on the [WRF-Hydro Docker Hub page]
(https://hub.docker.com/u/wrfhydro/).

## Where to get help and/or post issues
If you have general questions about Docker, there are ample online resources including the excellent Docker documentation at https://docs.docker.com/.
# Build Dockerfiles Locally

The best place ask questions or post issues with these lessons is via the Issues page of the GitHub
repository at https://github.com/NCAR/wrf_hydro_docker/issues.
```bash
$ make build
```

# Pull Docker Images From Dockerhub
```bash
$ docker pull wrfhydro/dev
or
$ docker pull wrfhydro/dev:latest
or
$ docker pull wrfhydro/dev:base
or
$ docker pull wrfhydro/dev:release
```

# Run Locally Built Dockerfiles

```bash
$ make run
or
$ make run-latest
or
$ make run-base
or
$ make run-release
```

For more information checkout [dev/README.md](dev/README.md).


# Docker Package and Training Charts
Expand Down Expand Up @@ -112,3 +136,10 @@ flowchart TD
nldas_mfe_forcing.tar.gz]
end
```


# Where to get help and/or post issues
If you have general questions about Docker, there are ample online resources including the excellent Docker documentation at https://docs.docker.com/.

The best place ask questions or post issues with these lessons is via the Issues page of the GitHub
repository at https://github.com/NCAR/wrf_hydro_docker/issues.
20 changes: 0 additions & 20 deletions build_all.sh

This file was deleted.

2 changes: 0 additions & 2 deletions build_deploy_deps.txt

This file was deleted.

25 changes: 0 additions & 25 deletions deploy_all.sh

This file was deleted.

10 changes: 4 additions & 6 deletions dev/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:24.04
FROM ubuntu:25.10
USER root

# WRF-Hydro dependencies
Expand All @@ -15,7 +15,7 @@ RUN apt-get update \
less \
libhdf5-dev \
libhdf5-openmpi-dev \
libnetcdf-pnetcdf-19 \
libnetcdf-pnetcdf-22 \
libnetcdf-dev \
libnetcdff-dev \
libnetcdff7 \
Expand Down Expand Up @@ -49,9 +49,7 @@ ENV NETCDF_LIB=/usr/local/lib
ENV NETCDF_INC=/usr/local/include

# create docker user
RUN useradd -ms /bin/bash docker \
&& usermod -aG sudo docker \
&& chmod -R 777 /home/docker/

RUN useradd -ms /bin/bash docker
USER docker
WORKDIR /home/docker
RUN git clone https://github.com/NCAR/wrf_hydro_nwm_public.git
12 changes: 12 additions & 0 deletions dev/base/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tag=wrfhydro/dev:base

all: build

build:
docker build -t ${tag} .

run:
docker run -it ${tag}

deploy:
docker push ${tag}
5 changes: 0 additions & 5 deletions dev/base/build.sh

This file was deleted.

14 changes: 6 additions & 8 deletions dev/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update \
nco \
nodejs \
pkg-config \
python3.12 \
python3 \
python3-dask \
python3-geopandas \
python3-ipython \
Expand All @@ -39,14 +39,16 @@ RUN apt-get update \

# cleanup
RUN rm -rf /tmp/*
RUN chmod -R 777 /home/docker/
RUN chown -R docker:docker /home/docker
RUN chown -R docker:docker /usr/local/

USER docker

# Miniforge and remaining Python packages
WORKDIR /home/docker
RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh \
&& bash Miniforge3-Linux-x86_64.sh -b -p /home/docker/miniforge3 \
&& rm Miniforge3-Linux-x86_64.sh \
&& chown -R docker:docker /home/docker/miniforge3
&& rm Miniforge3-Linux-x86_64.sh
ENV PATH="/home/docker/miniforge3/bin:${PATH}"
RUN mamba install -y -c conda-forge \
python=3.12 \
Expand All @@ -68,7 +70,6 @@ RUN mamba install -y -c conda-forge \
sqlite \
whitebox \
xrviz
# RUN chmod -R a+rwx /home/docker/miniforge3/

# R packages
RUN ver=1.24 \
Expand All @@ -79,9 +80,6 @@ RUN ver=1.24 \

# # Jupyter configuration script
# COPY ./jupyter_notebook_config.py /home/docker/.jupyter/
# RUN chmod -R 777 /home/docker/.jupyter

USER docker
WORKDIR /home/docker
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/home/docker/miniforge3/bin
ENV SHELL=bash
12 changes: 12 additions & 0 deletions dev/latest/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tag=wrfhydro/dev:latest

all: build

build:
docker build -t ${tag} .

run:
docker run -it ${tag}

deploy:
docker push ${tag}
5 changes: 0 additions & 5 deletions dev/latest/build.sh

This file was deleted.

3 changes: 2 additions & 1 deletion dev/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM wrfhydro/dev:base
USER docker
WORKDIR /home/docker

ENV VERSION=5.3.0
ENV VERSION=5.4.0
RUN rm -rf wrf_hydro_nwm_public
RUN wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v${VERSION}.tar.gz \
&& tar zxf v${VERSION}.tar.gz \
&& cd wrf_hydro_nwm_public-${VERSION} \
Expand Down
12 changes: 12 additions & 0 deletions dev/release/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tag=wrfhydro/dev:v5.4.0

all: build

build:
docker build -t ${tag} .

run:
docker run -it ${tag}

deploy:
docker push ${tag}
5 changes: 0 additions & 5 deletions dev/release/build.sh

This file was deleted.

22 changes: 0 additions & 22 deletions dev/release/entrypoint.sh

This file was deleted.