5. Tutorial for administrators of the wc_env and wc_env_dependencies images

Administrators should follow these steps to build and disseminate the wc_env and wc_env_dependencies images.

  1. Create contexts for building the wc_env and wc_env_dependencies Docker images.
  2. Create Dockerfile templates for the wc_env and wc_env_dependencies Docker images.
  3. Set the configuration for wc_env_manager.
  4. Use wc_env_manager to build the wc_env and wc_env_dependencies Docker images.
  5. Use wc_env_manager to push the wc_env and wc_env_dependencies Docker images to DockerHub.

5.1. Create contexts for building the wc_env and wc_env_dependencies images

First, create contexts for building the images. This can include licenses and installers for proprietary software packages.

  1. Prepare CPLEX installation
    1. Download CPLEX installer from https://ibm.onthehub.com
    2. Save the installer to the base image context
    3. Set the execution bit for the installer by running chmod ugo+x /path/to/installer
  2. Prepare Gurobi installation
    1. Create license at http://www.gurobi.com/downloads/licenses/license-center
    2. Copy the license to the gurobi_license build argument for the base image in the wc_env_manager configuration
  3. Prepare Mosek installation
    1. Request an academic license at https://license.mosek.com/academic/
    2. Receive a license by email
    3. Save the license to the context for the base image as mosek.lic
  4. Prepare XPRESS installation
    1. Install the XPRESS license server on another machine
      1. Download XPRESS from https://clientarea.xpress.fico.com
      2. Use the xphostid utility to get your host id
      3. Use the host id to create a floating license at https://app.xpress.fico.com
      4. Save the license file to the context for the base image as xpauth.xpr
      5. Run the installation program and follow the onscreen instructions
    2. Copy the IP address or hostname of the license server to the xpress_license_server build argument for the base image in the wc_env_manager configuration.
    3. Save the license file to the context for the base image as xpauth.xpr.
    4. Edit the server property in the first line of xpauth.xpr in the context for the base image. Set the property to the IP address or hostname of the license server.

5.2. Create Dockerfile templates for wc_env and wc_env_dependencies

Second, create templates for the Dockerfiles to be rendered by Jinja, and save the Dockerfiles within the contexts for the images. The default templates illustrate how to create the Dockerfile templates.

  • /path/to/wc_env_manager/wc_env_manager/assets/base-image/Dockerfile.template
  • /path/to/wc_env_manager/wc_env_manager/assets/image/Dockerfile.template

5.3. Set the configuration for wc_env_manager

Third, Set the configuration for wc_env_manager by creating a configuration file ./wc_env_manager.cfg following the schema outlined in /path/to/wc_env_manager/wc_env_manager/config/core.schema.cfg and the defaults in /path/to/wc_env_manager/wc_env_manager/config/core.default.cfg.

  • Set the repository and tags for wc_env and wc_env_dependencies.

  • Set the paths for the Dockerfile templates.

  • Set the contexts for building the Docker images and the files that should be copied into the images.

  • Set the build arguments for building the Docker images. This can include licenses for proprietary software packages. For example,:

    [wc_env_manager]
        [[base_image]]
            [[[build_args]]]
                gurobi_version = 8.0.1
                gurobi_license = ...
                ...
    
  • Set the WC modeling packages that should be installed into wc_env. For example,:

    [wc_env_manager]
        [[image]]
            python_packages = '''
                pytest
                pytest-cov
                git+https://github.com/KarrLab/log.git#egg=log-2016.10.12
                '''
    
  • Set your DockerHub username and password.

5.4. Build the wc_env and wc_env_dependencies Docker images

Use the following command to build the wc_env and wc_env_dependencies images:

wc_env_manager build

5.5. Push the wc_env and wc_env_dependencies Docker images to DockerHub

Use the following command to push the wc_env and wc_env_dependencies images to GitHub:

wc_env_manager push