Getting StartedDockerGitHub Container Registry

Deploying a Docker Image from the GitHub Container Registry

Flightcontrol supports deploying pre-built container images from three different image registries: Docker Hub, GitHub Container Registry, and the AWS Elastic Container Registry (ECR). This guide will walk you through deploying a Docker image from the GitHub Container Registry.

At this time, Flightcontrol’s GitHub Container Registry integration only supports publicly available images. If you would like to see support for private images, please vote for it on our roadmap. Otherwise, you can use AWS ECR or Docker Hub for private images in the mean time.

Prerequisites

You’ll need the following before you begin:

  • A public Docker image hosted on GitHub Container Registry
  • A GitHub repository (public or private) with your source code
  • An AWS account - Create an account
  • A Flightcontrol account - Create an account

Adding a GitHub Image Registry to Flightcontrol

Let’s use our access token to setup an image registry on Flightcontrol. Choose Image Registries from the sidebar in the dashboard.

Add an Image Registry

Click the Add an Image Registry button to add a new image registry.

Add an Image Registry to Flightcontrol

Choose the GitHub Registry Type

When you add a new image registry, you’ll need to choose the registry type. We’ll pick GitHub Container Registry.

New Image Registry screen on Flightcontrol

Add the GitHub Registry URI

The GitHub Registry URI will be in the format similar to the following:

ghcr.io/flightcontrol

Where flightcontrol would be the name of the GitHub organization or user account that owns the Docker image.

Creating a Flightcontrol Project

Now, let’s create a Flightcontrol project to deploy the Docker images from the GitHub Container Registry.

Create a new project in the Flightcontrol dashboard and choose a GitHub source code repository to use. You can choose a public or private repository. While Flightcontrol won’t use the source code in the repository to produce a build, you can use a flightcontrol.json file in the repository to configure your project.

For this guide, we’ll use the Flightcontrol dashboard to setup our project, instead of configuring with code using flightcontrol.json.

We’ll start with an empty project, and add a Web Server service to it.

Configuring the Web Server Service

After the Web Server service is added to your project, you’ll need to configure it. The default build type is Nixpacks, so we will need to change the build type to Pull from image registry.

Once we change the build type, a new set of configuration options will appear. Choose the GitHub container registry you created earlier, and enter the name of the Docker image you want to deploy. Typically, you will want to use the latest tag for your image, but you can use any tag here.

Configuring the Image Registry Build Type

Your web server service also needs a human readable name. You can also change the health check path your service needs - the default is ”/”. Double check the port number your service is listening on, and then click the Create service button.

You will be taken back to the Project screen, where you can see your new service.

Creating the Project

If your project needs any environment variables, you can add them now to the dashboard.

You can also add any auxiliary services your project needs, such as a database or Redis cache.

You can create your project with the Create Project button.

Flightcontrol will pull your Docker image from the GitHub Container Registry, and then deploy it to AWS ECS.

To put this together into a Continuous Deployment (CD) process, you can use a build pipeline to build, test and push your Docker images to the GitHub Container Registry. After a successful build, you can trigger a deployment with Flightcontrol using a Deploy Hook.

Automating the Deployment Process

Flightcontrol supports automatically deploying your application when you push a new image to the GitHub Container Registry. To do this, you’ll need to create a deploy hook in Flightcontrol, and then trigger the deploy hook when a new image is pushed.

Follow our guide on Automating Docker Deployments to learn how to create a deploy hook and then trigger it from your continuous integration (CI) pipeline.

Conclusion

With Flightcontrol serving as your continuous delivery (CD) platfom, you can deploy your Docker images from GitHub Container Registry to AWS ECS.

Use the build pipeline you already created to build, test and push your Docker images to the GitHub Container Registry, and then trigger a Flightcontrol deployment with an API call.