Skip to content

← Week 18 - Dockerfiles for .NET

Week 18 - Dockerfiles for .NET: notes

Status: Not started

Exercise 1

Write a multi-stage Dockerfile using the official mcr.microsoft.com/dotnet sdk and aspnet images.

Commands, results, what surprised me.

Exercise 2

Optimise layer caching (copy csproj and restore first), add .dockerignore, run as the non-root app user.

Commands, results, what surprised me.

Exercise 3

Add a HEALTHCHECK and an environment-based configuration.

Commands, results, what surprised me.

Exercise 4

Compare image sizes: sdk base, aspnet, alpine, chiseled.

Commands, results, what surprised me.

Deliverable

Dockerfile for your Blazor app with the image size before and after optimisation.

Write-up.