Skip to content

Commit

Permalink
Edit pass and zone pivots for related container content
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Jan 7, 2025
1 parent 9b57177 commit 49d9f1f
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 34 deletions.
198 changes: 166 additions & 32 deletions docs/core/docker/build-container.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/core/docker/snippets/8.0/App/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0@sha256:35792ea4ad1db051981f62b313f1be3b46b1f45cadbaa3c288cd0d3056eefb83 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:8.0@sha256:35792ea4ad1db051981f62b313f1be3b46b1f45cadbaa3c288cd0d3056eefb83 AS build
WORKDIR /App

# Copy everything
Expand All @@ -11,5 +11,5 @@ RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0@sha256:6c4df091e4e531bb93bdbfe7e7f0998e7ced344f54426b7e874116a3dc3233ff
WORKDIR /App
COPY --from=build-env /App/out .
COPY --from=build /App/out .
ENTRYPOINT ["dotnet", "DotNet.Docker.dll"]
2 changes: 2 additions & 0 deletions docs/core/docker/snippets/8.0/App/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var counter = 0;
var max = args.Length is not 0 ? Convert.ToInt32(args[0]) : -1;

while (max is -1 || counter < max)
{
Console.WriteLine($"Counter: {++counter}");

await Task.Delay(TimeSpan.FromMilliseconds(1_000));
}
15 changes: 15 additions & 0 deletions docs/core/docker/snippets/9.0/App/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0@sha256:3fcf6f1e809c0553f9feb222369f58749af314af6f063f389cbd2f913b4ad556 AS build
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:9.0@sha256:b4bea3a52a0a77317fa93c5bbdb076623f81e3e2f201078d89914da71318b5d8
WORKDIR /App
COPY --from=build /App/out .
ENTRYPOINT ["dotnet", "DotNet.Docker.dll"]
10 changes: 10 additions & 0 deletions docs/core/docker/snippets/9.0/App/DotNet.Docker.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
9 changes: 9 additions & 0 deletions docs/core/docker/snippets/9.0/App/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var counter = 0;
var max = args.Length is not 0 ? Convert.ToInt32(args[0]) : -1;

while (max is -1 || counter < max)
{
Console.WriteLine($"Counter: {++counter}");

await Task.Delay(TimeSpan.FromMilliseconds(1_000));
}

0 comments on commit 49d9f1f

Please sign in to comment.