Skip to content

Packaging app

KavinKrishnan edited this page Sep 10, 2021 · 29 revisions

In this step, the MONAI SDK application can now be built into a deployable Docker image using the MONAI Application Packager

Overview on MONAI Application Packager

The MONAI Application Packager (Packager) is a utility for building an application developed with the MONAI SDK into a structured MONAI application package (MAP).

The MAP produced by the Packager is a deployable and reusable docker image that can be launched locally or remotely

Basic Usage of MONAI Application Packager

monai-deploy package [Path of MONAI Application Code] -t [Tag for resulting Docker image of MONAI App Package]

Required Arguments

  • <MONAI application path> Path of MONAI Application Code
  • --tag, -t Tag for resulting Docker image of MONAI App Package

Optional Arguments

The following arguments have default values or are provided through the SDK if not specified. However, the user has the option to override these values if the choose to invoke the following flags

  • --base Base Application Image (overrides default "nvcr.io/nvidia/pytorch:21.07-py3")
  • --input-dir, -i Directory mounted in container for Application Input (overrides default "input")
  • --models-dir Directory mounted in container for Models Path (overrides default "/opt/monai/models")
  • --model, -m Path to local directory containing all application models (will override utilizing models provided within application SDK code)
  • --output-dir, -o Directory mounted in container for Application Output (overrides default "output")
  • --timeout Timeout (overrides default 0)
  • --version Version of the Application (overrides default "0.0.0")
  • --working-dir, -w Directory mounted in container for Application (overrides default "/var/monai")

Example of using MONAI Application Packager

Given an example MONAI SDK application with its code residing in a directory ./spleen_segmentation_app, packaging this application with the Packager to create an Docker image tagged monaispleen:latest would look like this:

$ monai-deploy package ./spleen_segmentation_app -t monaispleen:latest
Building MONAI Application Package...
Successfully built monaispleen:latest