Added debuggable Docker container definition. (#934)

Visual Studio 2017 and 2019 support debugging Docker containers. You need to install Docker for Windows for this to work, though, find it here: https://download.docker.com/win/stable/Docker%20Desktop%20Installer.exe.

This change adds a Docker container definition and the settings for Visual Studio to expose the containerized Aggregation server running on Linux through the default OPC UA port (62530).
This commit is contained in:
Erich Barnstedt
2020-04-01 15:05:36 +02:00
committed by GitHub
parent f4853f25f6
commit c7fa0f1b5d
8 changed files with 72 additions and 42 deletions
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>ConsoleAggregationServer</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>ConsoleAggregationServer</PackageId>
@@ -13,6 +13,8 @@
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileRunArguments>-p 62530:62530</DockerfileRunArguments>
</PropertyGroup>
<ItemGroup>
@@ -34,6 +36,10 @@
<Folder Include="Model\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
</ItemGroup>
<ItemGroup>
<None Update="Quickstarts.AggregationServer.Config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -0,0 +1,25 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ConsoleAggregationServer/ConsoleAggregationServer.csproj", "ConsoleAggregationServer/"]
COPY ["../../SDK/Opc.Ua.Server/Opc.Ua.Server.csproj", "../../SDK/Opc.Ua.Server/"]
COPY ["../../../Stack/Opc.Ua.Core/Opc.Ua.Core.csproj", "../../../Stack/Opc.Ua.Core/"]
COPY ["../../SDK/Opc.Ua.Configuration/Opc.Ua.Configuration.csproj", "../../SDK/Opc.Ua.Configuration/"]
COPY ["../../SDK/Opc.Ua.Client/Opc.Ua.Client.csproj", "../../SDK/Opc.Ua.Client/"]
RUN dotnet restore "ConsoleAggregationServer/ConsoleAggregationServer.csproj"
COPY . .
WORKDIR "/src/ConsoleAggregationServer"
RUN dotnet build "ConsoleAggregationServer.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ConsoleAggregationServer.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 62530
ENTRYPOINT ["dotnet", "ConsoleAggregationServer.dll"]
@@ -0,0 +1,10 @@
{
"profiles": {
"ConsoleAggregationServer": {
"commandName": "Project"
},
"Docker": {
"commandName": "Docker"
}
}
}
@@ -55,7 +55,7 @@
</TransportQuotas>
<ServerConfiguration>
<BaseAddresses>
<ua:String>opc.tcp://localhost:62541/AggregationServer</ua:String>
<ua:String>opc.tcp://localhost:62530/AggregationServer</ua:String>
</BaseAddresses>
<SecurityPolicies>
<ServerSecurityPolicy>
@@ -1,36 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>OPC Foundation UA Reference Server</title>
</head>
<body>
<h1>
OPC Foundation UA Reference Server</h1>
<h2>
Introduction:</h2>
<p style="margin-left: 40px">
This OPC Server is designed to be default OPC UA Server when opening the OPC UA
Compliance Test Tool (www.opcfoundation.org/uactt/) and uses an address-space
that matches the design of the CTT.</p>
<p style="margin-left: 40px">
This OPC Server is built with the Quickstart application template (OPC Server)
and uses the OPC Foundation .NET UA SDK. This OPC Server therefore supports the
opc.tcp and http transports.</p>
<p style="margin-left: 40px">
Download the CTT from: <a href="http://www.opcfoundation.org/uactt/">
http://www.opcfoundation.org/uactt/</a></p>
<h2>
<b>Finding the Address Space Configuration Code</b></h2>
<p style="margin-left: 40px">
<b>Project</b>: Reference Server<br />
<b>File</b>: ReferenceNodeManager.cs<br />
<b>Method</b>: CreateAddressSpace</p>
<h2>
Finding the UA Services</h2>
<p style="margin-left: 40px">
<b>Project</b>: UA Server Library<br />
<b>File</b>: \Server\StandardServer.cs</p>
</body>
</html>
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
# Visual Studio Version 16
VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UA Client Controls", "..\..\Samples\ClientControls.Net4\UA Client Controls.csproj", "{A247D2EE-14FC-463D-A9BA-6CFF1EF22B7A}"
EndProject
+2 -2
View File
@@ -4,7 +4,7 @@
#---------------------------------#
# version format
version: 1.4.359.{build}-{branch}
version: 1.4.360.{build}-{branch}
# branches to build
@@ -18,7 +18,7 @@ branches:
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2017
image: Visual Studio 2019
# scripts that are called at very beginning, before repo cloning
init: