Getting Started with Containerized Development in BuildMaster
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 to build correctly, securely, and compliantly, and the variety of layers can create a maintenance nightmare.
But by separating the application templates for base images and application images, BuildMaster 6.2 has innovated containerized development by:
- simplifying what can be the overwhelming complexity of building and managing containers
- bringing “order out of chaos” two ways:
- semantic versioning and obligate tagging of images (with ProGet)
- versioned and tracked DockerFile text templates
- facilitating compliance in container use by having two separate container registries stored in ProGet
- and offering environment parity, rather than developer parity, breaking the too common “it worked on my machine” pattern.
And Inedo helps you double down on container compliance by letting you separate the registries for base and application images in your ProGet instance.
This tutorial teaches you how to use both of BuildMaster’s container application templates—alongside the superior self-managed repository ProGet offers—to help you achieve these goals.
See BuildMaster containers in action—watch the webinar here.
To take advantage of BuildMaster’s first-class Docker support, you’ll need to get a few things installed and set up.
- BuildMaster, of course!
- This feature is only available on BuildMaster 6.2, which you can download here.
- If you already have an earlier version of BuildMaster, visit the “Administration” section in your BuildMaster settings to access the upgrade checklist. The upgrade to BuildMaster 6.2 is pretty big, and we want to help you make sure the transition is as smooth as possible.
- Docker (configured on a server, like localhost)
- The following BuildMaster extensions:
- Windows OR Linux extensions (depending on which OS you have Docker installed on)
Remember, requirements may vary based on your application’s build requirements and your Docker environment. For the containers used in this tutorial (and the images you’ll see below), we 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 SDK
Two additional points: First, if you are using ProGet in HTTP (not HTTPS), you will need to configure Docker’s insecure-registries to include your ProGet server URL. Second, if you’re running Docker on Windows Server 2016+, you will need to make your BuildMaster service to run as LocalSystem or an Administrator to allow it to interact with Docker on Windows.
Now that you have all your “ingredients” together, you can start “cooking up” some containers!
Creating a Base Image
Remember, you don’t have to create a separate base image in BuildMaster. You can still use BuildMaster to create your application image using a public base image. We suggest still using the Docker CI/CD template in BuildMaster, but from there, you can either use the DockerImage text template, or if you are only using only one container for your application, you can still use the no DockerFile approach detailed in the next section (“Creating an Application Image”). But creating a separate base image in BuildMaster and storing it in your instance of ProGet or other private container registry, you add extra layers of security and simplify compliance with containers.
To begin creating your base image in BuildMaster, go to the “Applications” tab and click “Create Application.”
You’ll then see the same selection of application templates discussed in detail here.
Select the “Docker Base Image” template. Give your base image a name, and then apply the template.
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.”
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. Download ProGet here.
Then set the value for your Container Repository Name, and then save the resource.
Once you save this resource, the application setup template will “refresh,” clearing the warning icons and bottom message if you’ve done everything correctly and can continue.
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.
Now you’re ready to kick off your build and get this base image built!
Run this through the pipeline and deploy it to production.
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!
Create an Application Image
Whether you’re using a base image created 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, the application startup template will display, again showing the “warning” icons for values you must set before continuing.
Set the value for Base Container Source to your ProGet Base Image container registry.
Then set the value for your Base Container Repository Name.
Next, set the value for Container Source to your ProGet Application Image container registry.
And finally, set the value for your Container Repository 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.
You can choose between using a DockerFile or no DockerFile, removing the option you choose not 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—requiring absolutely no expertise in Docker! Both work equally effectively, and while you don’t have to remove the unwanted option, leaving both in results in BuildMaster running the Docker build procedure twice. For our demo and this tutorial, we chose no DockerFile (Option Two).
Now, run the image you are creating through the normal CI/CD pipeline stages! BuildMaster’s pipelines are preconfigured for general best practices (Build, Integration, Testing, Production), but all can be configured and adjusted to meet your specific needs.
It really is that easy!
Download BuildMaster 6.2 today to try this innovative way to create containers:
Already have an earlier version of BuildMaster? Visit the “Administration” page in your instance to access the upgrade checklist before switching to 6.2 (it’s a big change, so we want to make sure it goes smoothly!).