Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Reduce application image build times with .NET Core incremental builds

April 8, 2019
Tom Deseyn
Related topics:
KubernetesContainers.NET
Related products:
Red Hat OpenShift Container Platform

    In a previous article, we talked about using containers to build .NET Core application images to make our builds portable and reproducible. Because each build starts from scratch, some time is spent downloading and extracting NuGet packages.

    One way to reduce build times is to add a local NuGet server; this brings packages closer to the build machines, which reduces the time to download the packages. In this article, we'll look at how the new incremental build feature of the .NET Core S2I builder can further reduce build times.

    The .NET Core S2I builder now supports incremental builds. When we do an incremental build, the builder will reuse the NuGet packages from a previously built application image. So, the first build of the application image will fetch packages from the NuGet server, and successive builds will reuse those packages.

    To perform incremental builds using the source-to-image (s2i) tool, we need to pass the --incremental flag. By default, the .NET Core S2I builder will remove NuGet packages to reduce the size of the application image. To keep those packages around, we need to set the DOTNET_INCREMENTAL environment variable to true.

    On my development machine, performing an s2i build for the dotnet new mvc-template gives these build times:

    S2I Total time Restore time
    First build 35s 16.5s
    Successive build 24.5s 0.5s

    We see the build time goes down thanks to the reduced restore time; however, the total time doesn't go down by the same amount. This is because we spend extra time to extract the NuGet packages from the previous application image. Note that the previous application image is already present on the build machine, so we spend no time fetching it from an image registry.

    Red Hat OpenShift Container Platform can also be configured to perform incremental builds. Let’s look at the build time difference using a free Red Hat OpenShift Online account.

    Free OpenShift Online account Total time Restore time
    Non-incremental build 2m18s 28.5s
    Successive incremental build 4m45s 2s

    In this case, the incremental build is slower. Fetching packages from the NuGet server is faster than retrieving the previously built application image from the cluster container image registry and then extracting the packages from it.

    Let’s do this again. Now we’ll use an on-premise Red Hat OpenShift test cluster. These are the build times:

    OpenShift test cluster Total time Restore time
    Non-incremental build 1m12s 12.72s
    Successive incremental build 1m53s 1s

    The build times are closer, but again, the non-incremental build is faster thanks to the high bandwidth to the NuGet server compared to the container registry.

    Conclusion

    In this article, we looked at the new incremental build feature of the S2I .NET Core builder. When using s2i on a developer machine, the incremental builds are faster when a previously built application image is already present on the machine. This is not the case when building on OpenShift. It depends on the bandwidth to the cluster image registry compared to the bandwidth to the NuGet server whether incremental or non-incremental builds are faster.

    Last updated: September 3, 2019

    Recent Posts

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.