Skip to content

Dockerfile for new pcrglob version #3

@BSchilperoort

Description

@BSchilperoort

I worked on making the Docker image up to date with UU-Hydro/PCR-GLOBWB_model.

This is the current state:

Dockerfile
# DockerFile for PCR-GLOB model. The ini-file should be mounted as config.ini,
# the input data root directory should be mounted as /data
FROM alpine/git:latest as builder
LABEL maintainer="Bart Schilperoort <[email protected]>"
WORKDIR /opt
RUN git clone https://github.com/UU-Hydro/PCR-GLOBWB_model.git
WORKDIR /opt/PCR-GLOBWB_model

# Pick the branch/tag:
# RUN git checkout feature/arise_30sec_aqueduct_2022-04-14
RUN git checkout v2.4.0_alpha

FROM mambaorg/micromamba:1.3.1

ENV HOME=/home/$MAMBA_USER

COPY --chown=$MAMBA_USER:$MAMBA_USER --from=builder /opt/PCR-GLOBWB_model/conda_env/pcrglobwb_py3_standard.yml $HOME/pcrglobwb_py3_standard.yml
COPY --chown=$MAMBA_USER:$MAMBA_USER --from=builder /opt/PCR-GLOBWB_model $HOME/PCR-GLOBWB_model

WORKDIR $HOME/

# Install PCR-GLOB python environment
RUN micromamba install -y \
    -n base \
    -c conda-forge python=3.10 \
    --file pcrglobwb_py3_standard.yml

# Make sure the conda environment is activated for the remaining build
# instructions below
# (otherwise python will not be found)
ARG MAMBA_DOCKERFILE_ACTIVATE=1  

# Set Volumes
VOLUME /config.ini
VOLUME /data

WORKDIR $HOME/PCR-GLOBWB_model/model

# gcc is required for Cython. We already have micromamba, so we can do:
RUN micromamba install gcc -c conda-forge

# Install cython and compile the imagemean.pyx cython code
RUN pip install Cython
RUN python3 setup.py build_ext --inplace

# # Install GRPC4BMI
RUN pip install grpc4bmi==0.4.0

# # Default command should be to run GRPC4BMI server
# # Don't override micromamba's entrypoint as that activates conda!
CMD run-bmi-server \
    --path "/home/mambauser/PCR-GLOBWB_model/model" \
    --name "bmiPcrglobwb.BmiPCRGlobWB" \
    --bmi-version 0.2 \ 
    --port 55555 --debug

To make this image work with eWaterCycle the BMI has to be updated on the UU-Hydro repository. Additionally, the following setting has to be changed UU-Hydro/PCR-GLOBWB_model@master...BSchilperoort:PCR-GLOBWB_model:master

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions