Containerizing a Custom Component

Package your code so it can be deployed to a cluster

πŸ” Introduction

In order to deploy your custom component code to a cluster, you must first package it into a Docker container and upload that container to a remote registry.

Prerequisites

Before working on this guide, you need to write the code for your custom blueprint and have it saved locally. See Writing a custom blueprint for more information.

We also recommend writing thorough unit tests for your code before packaging it for deployment.

πŸ” Necessary Permissions

Before containerizing your application, you will need access to Gemfury, our private package repository, and Harbor, our private registry for Docker images. Please send an email to [email protected] requesting access, and we will set it up for you.

πŸ’Ž Gemfury

Gemfury is a private package repository that Indico uses to store our libraries. All custom components depend on these four custom Indico libraries:

  • indicore
  • jetstream
  • workflows
  • workflows-v2

Indico support will provide you with a token to access Gemfury. Once you have this token, we recommend saving it as the environment variable GEMFURY_TOKEN.

If you are using Poetry for python package management, configure poetry to use your Gemfury token: poetry config http-basic.fury $GEMFURY_TOKEN NOPASS

If you prefer to use Pip, see this guide from Gemfury about how to configure permissions.

🚒 Harbor

Indico will create a private Harbor registry for you to store your Docker images once they have been built. We will provide you with a username and password to access your Harbor registry.

πŸ“ Writing a Dockerfile

A Dockerfile tells Docker exactly how to package your code, including what sort of environments to run it in and any necessary dependencies. The following recipe guides you through writing a Dockerfile for your custom component.

For more information about Docker and best practices for writing a Dockerfile, see the Docker documentation.

πŸ“€ Creating and pushing your image

Once your Dockerfile is complete, use the Docker Command Line Interface to build your image and push it to your Harbor registry.

If you do not have Docker on your machine, you can install it by following these instructions.