Skip to content

Commit 711988e

Browse files
cquirosjDavidBoike
andauthored
Updating hosting docker sample (#6853)
Co-authored-by: David Boike <[email protected]>
1 parent 31d800d commit 711988e

File tree

10 files changed

+15
-12
lines changed

10 files changed

+15
-12
lines changed

samples/hosting/docker/Core_7/Receiver/Receiver.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<LangVersion>10.0</LangVersion>
6+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
67
</PropertyGroup>
78
<ItemGroup>
89
<ProjectReference Include="..\Shared\Shared.csproj" />
910
</ItemGroup>
1011
<ItemGroup>
11-
<PackageReference Include="Microsoft.Net.Build.Containers" Version="8.*" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.*" />
1313
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="1.*" />
1414
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="2.*" />

samples/hosting/docker/Core_7/Sender/Sender.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<LangVersion>10.0</LangVersion>
6+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
67
</PropertyGroup>
78
<ItemGroup>
89
<ProjectReference Include="..\Shared\Shared.csproj" />
910
</ItemGroup>
1011
<ItemGroup>
11-
<PackageReference Include="Microsoft.Net.Build.Containers" Version="8.*" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.*" />
1313
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="1.*" />
1414
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="2.*" />

samples/hosting/docker/Core_7/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# startcode compose
2-
version: "3.8"
32
services:
43
sender:
54
image: sender

samples/hosting/docker/Core_8/Receiver/Receiver.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<LangVersion>10.0</LangVersion>
6+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
67
</PropertyGroup>
78
<ItemGroup>
89
<ProjectReference Include="..\Shared\Shared.csproj" />
910
</ItemGroup>
1011
<ItemGroup>
11-
<PackageReference Include="Microsoft.Net.Build.Containers" Version="8.*" />
1212
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="2.*" />
1313
<PackageReference Include="NServiceBus.RabbitMQ" Version="8.*" />
1414
<PackageReference Include="RabbitMQ.Client" Version="6.*" />

samples/hosting/docker/Core_8/Sender/Sender.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<LangVersion>10.0</LangVersion>
6+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
67
</PropertyGroup>
78
<ItemGroup>
89
<ProjectReference Include="..\Shared\Shared.csproj" />
910
</ItemGroup>
1011
<ItemGroup>
11-
<PackageReference Include="Microsoft.Net.Build.Containers" Version="8.*" />
1212
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="2.*" />
1313
<PackageReference Include="NServiceBus.RabbitMQ" Version="8.*" />
1414
<PackageReference Include="RabbitMQ.Client" Version="6.*" />

samples/hosting/docker/Core_8/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# startcode compose
2-
version: "3.8"
32
services:
43
sender:
54
image: sender

samples/hosting/docker/Core_9/Receiver/Receiver.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<LangVersion>12.0</LangVersion>
9+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
910
</PropertyGroup>
1011

1112
<ItemGroup>
1213
<ProjectReference Include="..\Shared\Shared.csproj" />
1314
</ItemGroup>
1415

1516
<ItemGroup>
16-
<PackageReference Include="Microsoft.Net.Build.Containers" Version="8.*" />
1717
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="3.*" />
1818
<PackageReference Include="NServiceBus.RabbitMQ" Version="9.*" />
1919
<PackageReference Include="RabbitMQ.Client" Version="6.*" />

samples/hosting/docker/Core_9/Sender/Sender.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<LangVersion>12.0</LangVersion>
9+
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
910
</PropertyGroup>
1011

1112
<ItemGroup>

samples/hosting/docker/Core_9/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# startcode compose
2-
version: "3.8"
32
services:
43
sender:
54
image: sender

samples/hosting/docker/sample.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ redirects:
1212

1313
This sample demonstrates how to use Docker Linux containers to host NServiceBus endpoints communicating over the [RabbitMQ transport](/transports/rabbitmq/). While this sample uses [Docker Compose](https://docs.docker.com/compose/) to demonstrate how to orchestrate a multi-container application, the containers are compatible withe other orchestration technologies, for example [Kubernetes](https://kubernetes.io/docs/home/).
1414

15+
The endpoints use the [.NET SDK Container Building Tools](https://github.com/dotnet/sdk-container-builds) to enable the creation of containers via the `dotnet publish` command. See the [Microsoft tutorial](https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-8-0) and [customization documentation](https://github.com/dotnet/sdk-container-builds/blob/main/docs/ContainerCustomization.md) for more details.
16+
17+
## Prerequisites
18+
19+
To containerize a .NET app using `dotnet publish`:
20+
21+
- **[.NET 8.0.200 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)** (or higher): Check your installed SDK version with `dotnet --info`.
22+
- **[Docker Community Edition](https://www.docker.com/products/docker-desktop)**: Ensure Docker is installed and running on your system.
23+
1524
## Running the sample
1625

1726
Running the sample involves building the container images and starting the multi-container application.
@@ -54,10 +63,6 @@ docker-compose down
5463

5564
This sample consists of `Sender` and `Receiver` endpoints exchanging messages using the [RabbitMQ transport](/transports/rabbitmq/). Each of these three components runs in a separate Docker Linux container.
5665

57-
### Endpoint containers
58-
59-
The endpoints use the [.NET SDK Container Building Tools](https://github.com/dotnet/sdk-container-builds) to enable the creation of containers via the `dotnet publish` command. See the [Microsoft tutorial](https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-8-0) and [customization documentation](https://github.com/dotnet/sdk-container-builds/blob/main/docs/ContainerCustomization.md) for more details.
60-
6166
### Orchestration
6267

6368
Endpoint container images for the `Sender` and the `Receiver` are combined with an official [RabbitMQ image](https://hub.docker.com/_/rabbitmq/) to create a multi-container application using [Docker Compose](https://docs.docker.com/compose/):

0 commit comments

Comments
 (0)