Skip to content

Commit

Permalink
leverage binary ed build
Browse files Browse the repository at this point in the history
  • Loading branch information
robkooper committed Sep 2, 2024
1 parent f79dd14 commit a903d43
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 37 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ jobs:
name:
- basgra
- biocro
- ed2_2.2.0
# - ed2_2.2.0
- ed2_git
- maespa
- sipnet
Expand All @@ -303,12 +303,12 @@ jobs:
PLATFORM: "linux/amd64"
MODEL: biocro
VERSION: "0.95"
- name: ed2_2.2.0
CONTEXT: models/ed
DOCKERFILE: models/ed/Dockerfile
PLATFORM: "linux/amd64"
MODEL: ed2
VERSION: "2.2.0"
# - name: ed2_2.2.0
# CONTEXT: models/ed
# DOCKERFILE: models/ed/Dockerfile
# PLATFORM: "linux/amd64"
# MODEL: ed2
# VERSION: "2.2.0"
- name: ed2_git
CONTEXT: models/ed
DOCKERFILE: models/ed/Dockerfile
Expand Down
66 changes: 36 additions & 30 deletions models/ed/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
# this needs to be at the top, what version are we building
ARG IMAGE_VERSION="latest"
# # this needs to be at the top, what version are we building
# ARG IMAGE_VERSION="latest"

# ----------------------------------------------------------------------
# BUILD MODEL BINARY
# ----------------------------------------------------------------------
FROM pecan/models:${IMAGE_VERSION} as model-binary
# # ----------------------------------------------------------------------
# # BUILD MODEL BINARY
# # ----------------------------------------------------------------------
# FROM pecan/models:${IMAGE_VERSION} as model-binary

# Some variables that can be used to set control the docker build
ARG MODEL_VERSION="2.2.0"
ARG BINARY_VERSION="2.2"
# # Some variables that can be used to set control the docker build
# ARG MODEL_VERSION="2.2.0"
# ARG BINARY_VERSION="2.2"

# specify fortran compiler
ENV FC_TYPE=GNU
# # specify fortran compiler
# ENV FC_TYPE=GNU

# install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
gfortran \
git \
libhdf5-dev \
libopenmpi-dev \
&& rm -rf /var/lib/apt/lists/*
# # install dependencies
# RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# build-essential \
# curl \
# gfortran \
# git \
# libhdf5-dev \
# libopenmpi-dev \
# && rm -rf /var/lib/apt/lists/*

# download, unzip and build ed2
WORKDIR /src
RUN git -c http.sslVerify=false clone https://github.com/EDmodel/ED2.git \
&& cd ED2/ED/build \
&& curl -o make/include.mk.VM http://isda.ncsa.illinois.edu/~kooper/EBI/include.mk.opt.`uname -s` \
&& if [ "${MODEL_VERSION}" != "git" ]; then git checkout "v.${MODEL_VERSION}"; fi \
&& ./install.sh -g -p VM \
&& mv /src/ED2/ED/build/ed_${BINARY_VERSION}-opt /src/ED2/ED/build/ed
# # download, unzip and build ed2
# WORKDIR /src
# RUN git -c http.sslVerify=false clone https://github.com/EDmodel/ED2.git \
# && cd ED2/ED/build \
# && curl -o make/include.mk.VM http://isda.ncsa.illinois.edu/~kooper/EBI/include.mk.opt.`uname -s` \
# && if [ "${MODEL_VERSION}" != "git" ]; then git checkout "v.${MODEL_VERSION}"; fi \
# && ./install.sh -g -p VM \
# && mv /src/ED2/ED/build/ed_${BINARY_VERSION}-opt /src/ED2/ED/build/ed

########################################################################

# ----------------------------------------------------------------------
# ED MODEL
# ----------------------------------------------------------------------
FROM edmodel/ed2:gnu AS model-binary

# ----------------------------------------------------------------------
# BUILD PECAN FOR MODEL
# ----------------------------------------------------------------------
Expand Down Expand Up @@ -66,4 +71,5 @@ RUN sed -i -e "s/@VERSION@/${MODEL_VERSION}/g" \
-e "s#@BINARY@#/usr/local/bin/ed.${MODEL_VERSION}#g" /work/model.json

# COPY model binary
COPY --from=model-binary /src/ED2/ED/build/ed /usr/local/bin/ed.${MODEL_VERSION}
# COPY --from=model-binary /src/ED2/ED/build/ed /usr/local/bin/ed.${MODEL_VERSION}
COPY --from=model-binary /usr/bin/ed2 /usr/local/bin/ed.${MODEL_VERSION}

0 comments on commit a903d43

Please sign in to comment.