Skip to content

Move model download from the Docker image build step to the run script #8

@notocwilson

Description

@notocwilson

With the Docker files, as designed currently, you are staging a rather large file inside of a Docker image, which arguably violates the Docker Image best practice guideline of Don't install unnecessary packages. Ultimately, this dramatically inflates the size of the image to contain the model when it should be treated as a static asset that should be attached to a container.

By migrating the code to download the model to the run script, operators can now attach a volume to /models with storage that is defined outside of the context of the container. This could be a volume that lives on the same host, just as it did before if it was in the context of the Image, or could be provided by any other storage driver supported by Docker. Changes to the Docker Image will not require re-downloading and re-staging the model, significantly lowering both build time and bandwidth required to rebuild the image.

In summary:

  • Remove downloading the model from the Dockerfile for the API service.
  • Update the API service in the compose files to mount a Docker Volume to /models
  • Enhance run.sh with a simple model download manager to check for the existence of a model, and if it does not exist, download it
  • Optional: Expose the model to run as an environment variable, simplifying the amount of Dockerfiles needed to support the project. Have the run.sh model download manager use the environment variable as input to specify what model to check, optionally run, and launch with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions