Twitter : @Chris_L_Ayers Mastodon: @Chrisayers@hachyderm.io LinkedIn: chris-l-ayers Blog: https://chris-ayers.com/ GitHub: Codebytes
Dapr provides integrated APIs for communication, state, and workflow.
Container
Virtual Machines (VMs)
Container images bundle application code with the necessary runtime, libraries, and configurations. They utilize a Layered File System for efficient storage and distribution:
Central hubs for storing, managing, and distributing container images, featuring:
Container runtimes are the engines that run containers and manage their lifecycles, with different levels of abstraction:
Stable tags help maintain base images for container builds. Avoid using them for deployments since they receive updates that might cause inconsistencies in production. Examples include:
Unique tags track specific builds or versions of an image. They often include build numbers, commit hashes, or timestamps. These are great for CI/CD pipelines and testing environments. Examples include:
Microsoft provides official .NET container images for various scenarios, including:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env WORKDIR /App # Copy everything COPY . ./ # Restore as distinct layers RUN dotnet restore # Build and publish a release RUN dotnet publish -c Release -o out # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /App COPY --from=build-env /App/out . ENTRYPOINT ["dotnet", "DotNet.Docker.dll"]
dotnet
-p:PublishContainer
Microsoft has been providing .NET Container images for almost 10 years. Consistent Themes
Externalize app settings for easy updates without image rebuilds.
catalog-api: image: eshop/catalog-api environment: - Endpoint=XXXXXX expose: - "80" ports: - "5101:80"
spec: template: spec: containers: - name: sampleapi image: codebytes/sampleapi:1.0.1 env: - name: "ASPNETCORE_ENVIRONMENT" value: "Production" - name: "ASPNETCORE_FORWARDEDHEADERS_ENABLED" value: "true"
Identify security vulnerabilities and compliance issues in container images.
The Restricted policy enhances security for critical applications by enforcing pod hardening practices.
spec: securityContext: runAsNonRoot: true containers: - name: aspnetapp image: mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled ports: - containerPort: 8080
Learn more about Kubernetes Pod Security Standards
azd init
https://github.com/codebytes/containerizing-dotnet
Twitter: @Chris_L_Ayers Mastodon: @Chrisayers@hachyderm.io LinkedIn: - chris-l-ayers Blog: https://chris-ayers.com/ GitHub: Codebytes