Getting Started with Containerized Development in BuildMaster
  • 25 Jan 2023
  • 5 Minutes to read
  • Dark
    Light
  • PDF

Getting Started with Containerized Development in BuildMaster

  • Dark
    Light
  • PDF

Developing with containers is one of the most popular development methods today. Containers can be really great because they encapsulate dependencies and isolate processes.But containers can also be very complicated when it comes to building them correctly, securely and compliantly, and the variety of layers can become a maintenance nightmare

By separating application templates for base images and application images, BuildMaster has innovated containerized development:

  • simplifying the often overwhelming complexity of building and managing containers
  • bringing "order out of chaos" in two ways: * semantic versioning and mandatory tagging of images (using ProGet) * versioned and tracked DockerFile text templates
  • facilitating compliance when using containers by having two separate container registries stored in ProGet
  • and providing environment parity instead of developer parity, breaking the all-too-common "it worked on my machine" pattern.

​Inedo helps you comply with container compliance by allowing you to separate registrations for base and application images in your ProGet instance.

In this tutorial, you will learn how to leverage BuildMaster's two container application templates along with ProGet's superior self-managed repository to achieve these goals.

See BuildMaster containers in action webinar

Requirements

To take advantage of BuildMaster’s first-class Docker support, you’ll need to get a few things installed and set up.

  • Docker (configured on a server, like localhost)
  • The following BuildMaster extensions:
    • Docker
    • Windows OR Linux extensions (depending on which OS you have Docker installed on)

Remember that the requirements may vary depending on the build requirements of your application and your Docker environment. For the containers used in this tutorial (and the images you'll see below), we have configured:

  • Docker configured on your BuildMaster server
  • Microsoft Build Tools for Visual Studio 2019 with . NET Core 2.1 LTS build support
  • BuildMaster extensions for:
    • Windows
    • Windows SDK
    • GitHub

Two additional points: First, if you are using ProGet over HTTP (not HTTPS), you must configure Docker's insecure registries to include the URL of your ProGet server. Second, if you are running Docker on Windows Server 2016+, you need to have your BuildMaster service run as LocalSystem or as Administrator so that it can interact with Docker on Windows.

Now that you have all the pieces, you can start making some containers!

Creating a Base Image

Remember that you do not need to create a separate base image in BuildMaster. You can still use BuildMaster to create your application image using a public base image. We recommend using the Docker CI/CD template in BuildMaster, but from there you can either use the DockerImage text template, or if you are just using a container for your application, you can still use the no DockerFile approach described in the next section (Creating an Application Image). However, by creating a separate base image in BuildMaster and storing it in your instance of ProGet or another private container registry, you add additional layers of security and simplify container compliance.

To begin creating your base image in BuildMaster, go to the Applications tab and click Create Application.
Create-Application

You’ll see the same selection of application templates discussed in detail here.
All-templates

Select the Docker Base Image template. Give your base image a name, then apply the template.
create-container-application

The application startup template will have a warning icon next to the values you must set before continuing. They are Container Source and Container Repository Name.
containers-template-applied

Set the value for Container Source to your ProGet Base Image container registry, and save the resource. Remember, you can use another private registry, but we recommend ProGet because it was developed alongside BuildMaster and offers a seamless integration.
save-resource

Then set the value for your Container Repository Name and save the resource.
edit-variable

Once you save this resource, the application setup template will refresh, clearing the warning icons and bottom message. If you’ve done everything correctly, you can continue.
template-no-warning

Optionally, you can go to Configuration > Text Templates to make sure your DockerFile includes the required containers. You don’t have to do this, but we recommend it as a best practice.
dockerfile

Now, you’re ready to kick off your build and get this base image built!
create-build

Run this through the pipeline and deploy it to production.
elease-build

Remember, you can always edit your pipelines to meet your security and compliance needs, but don’t forget that in all versions of BuildMaster Free, every user has Admin status. You can change permissions at granular levels in the paid versions of BuildMaster.

Congratulations! You’ve created your first base image in BuildMaster! If you go to your container registry, you’ll see this image listed. It’s now ready for use!
docker-proget

Create an Application Image

Whether you use a base image from the instructions above or another base image, it's easy to create your application image.

Click Create Application again, but this time select the Docker CI/CD template.

After you apply the template, you'll see the launch template for the application, which again contains the warning icons for the values you need to set before proceeding.
image

Set the value for Base Container Source to your ProGet Base Image container registry.
image

Then set the value for your Base Container Repository Name.
image

Next, set the value for Container Source to your ProGet Application Image container registry.
edit-resource

And finally, set the value for your Container Repository Name.
container-repo-name

This time, you definitely want to view your Scripts. You’ll see that Inedo has set up the Docker CI/CD with two options for the Package OtterScript plan.
image

You can choose between using a Docker file or no Docker file, and remove the option you do not want to use. Option two (Build Image – use DockerFile) runs like the Base Image template. But option one (Assemble Image – no DockerFile) lets you build a container for your application as if you were creating any kind of non-container build, this requires absolutely no knowledge of Docker! Both work equally effectively, and while you do not need to remove the unwanted option, leaving both options will cause BuildMaster to run the Docker build procedure twice. For our demo and this tutorial, we chose no DockerFile (option two).

Now run the image you created through the normal CI/CD pipeline stages! BuildMaster's pipelines are pre-configured for general best practices (Build, Integration, Testing, Production), but they can all be configured and customized to your specific needs.

It really is that simple!


Was this article helpful?

What's Next