-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2591 from robkooper/modelinfo_dockerfile_template
add dockerfile, model_info.json to template (fixes #2567)
- Loading branch information
Showing
5 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Dockerfile | ||
model_info.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
######################################################################## | ||
# First we build the actual model, this has everything that is needed | ||
# for the model to compile. Next we create the final image that has the | ||
# PEcAn code as well as only the model binary. | ||
######################################################################## | ||
|
||
# this needs to be at the top, what version are we building | ||
ARG IMAGE_VERSION="latest" | ||
|
||
# ---------------------------------------------------------------------- | ||
# BUILD MODEL BINARY | ||
# ---------------------------------------------------------------------- | ||
FROM debian:stretch as model-binary | ||
|
||
# Some variables that can be used to set control the docker build | ||
ARG MODEL_VERSION=git | ||
|
||
# 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 clone https://github.com/model/repo.git \ | ||
&& cd repo \ | ||
&& if [ "${MODEL_VERSION}" != "git" ]; then git checkout "v.${MODEL_VERSION}"; fi \ | ||
&& ./configure \ | ||
&& make | ||
|
||
######################################################################## | ||
|
||
# ---------------------------------------------------------------------- | ||
# BUILD PECAN FOR MODEL | ||
# ---------------------------------------------------------------------- | ||
FROM pecan/models:${IMAGE_VERSION} | ||
|
||
# ---------------------------------------------------------------------- | ||
# INSTALL MODEL SPECIFIC PIECES | ||
# ---------------------------------------------------------------------- | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
libgfortran3 \ | ||
libopenmpi2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# ---------------------------------------------------------------------- | ||
# SETUP FOR SPECIFIC MODEL | ||
# ---------------------------------------------------------------------- | ||
|
||
# Some variables that can be used to set control the docker build | ||
ARG MODEL_VERSION=git | ||
|
||
# Setup model_info file | ||
# @VERSION@ is replaced with model version in the model_info.json file | ||
# @BINARY@ is replaced with model binary in the model_info.json file | ||
COPY model_info.json /work/model.json | ||
RUN sed -i -e "s/@VERSION@/${MODEL_VERSION}/g" \ | ||
-e "s#@BINARY@#/usr/local/bin/model#g" /work/model.json | ||
|
||
# COPY model binary | ||
COPY --from=model-binary /src/repo/src/model /usr/local/bin/model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "Name of model, displayed in UI", | ||
"type": "Type of model", | ||
"version": "@VERSION@", | ||
"binary": "@BINARY@", | ||
"description": "Longer description of the model, right now only displayed in the monitor", | ||
"creator": "Main creator of model", | ||
"contributors": ["List of contributors", "Both for model", "And PEcAn code for model"], | ||
"links": [ | ||
{ | ||
"type": "git", | ||
"description": "Link to source code, if not exist, just remove", | ||
"url": "https://github.com/...." | ||
}, | ||
{ | ||
"type": "issues", | ||
"description": "Link to issues, if not exist, just remove", | ||
"url": "https://github.com/..../issues" | ||
}, | ||
{ | ||
"type": "documentation", | ||
"description": "Link to documentation, if not exist, just remove", | ||
"url": "https://github.com/..../wiki" | ||
}, | ||
{ | ||
"type": "docker", | ||
"description": "Link to docker image, if not exist, just remove", | ||
"url": "organization/image" | ||
} | ||
], | ||
"inputs": {}, | ||
"bibtex": [ | ||
"How to cite the model, paper 1", | ||
"How to cite the model, paper 2" | ||
] | ||
} |