mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-20 08:41:51 +08:00
de3476d332
# Description `Opc.Ua.Server` and `Opc.Ua.Gds.Server.Common` depended directly on `Opc.Ua.Bindings.Https`, which pulled ASP.NET Core into server applications even when optional HTTPS-based transports were not used. - Remove the HTTPS binding project references from Server and GDS entirely. - Add a Core-owned `IOpcUaTransportBuilder` contract for builders that support transport registration. - Move the type-preserving HTTPS, WSS, Kestrel OPC TCP, and Web API fluent extensions into `Opc.Ua.Bindings.Https`. - Remove the repository-wide `NoHttps` / `NOHTTPS` build switch. - Keep ConsoleReferenceServer HTTPS/WSS support through an explicit binding reference and the ASP.NET Core container runtime. - Document that applications must reference the optional binding package directly. ## Validation - Built `Opc.Ua.Bindings.Https` in Release for all target frameworks. - Built Server and GDS for .NET 10 and .NET Framework 4.8. - Built ConsoleReferenceServer and PumpDeviceIntegrationServer for .NET 10. - Passed 65 HTTPS binding dependency-injection tests. - Passed focused Server and GDS transport-builder tests. - Verified refreshed Server/GDS restore assets and output manifests contain no `Opc.Ua.Bindings.Https` dependency. ## Related Issues Fixes #4296 ## Checklist - [ ] I have signed the [CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf) and read the [CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md) doc. - [x] I have added tests that prove my fix is effective. - [x] I have added all necessary documentation. - [x] I have verified that my changes do not introduce build or analyzer warnings. - [ ] I ran all tests locally using the `UA.slnx` solution against .NET Framework and .NET 10. - [ ] I fixed all failing and flaky tests in the CI pipelines and all CodeQL warnings. - [x] I have addressed all PR feedback received. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com> Co-authored-by: Marc Schier <mschier@microsoft.com> Co-authored-by: romanett <7413710+romanett@users.noreply.github.com> Copilot-Session: 41b98d43-8bb8-4587-8f3b-9532544dd582
99 lines
3.8 KiB
Docker
99 lines
3.8 KiB
Docker
# PumpDeviceIntegrationServer container image.
|
|
#
|
|
# Multi-stage, framework-dependent build on the .NET AzureLinux 3 base
|
|
# images.
|
|
#
|
|
# IMPORTANT: the build context MUST be the repository ROOT (not this
|
|
# folder), because the project pulls in the whole source tree (src/,
|
|
# src/, tools/). Build it like this:
|
|
#
|
|
# # from the repository root:
|
|
# docker build -f samples/DI/PumpDeviceIntegrationServer/Dockerfile \
|
|
# -t pumpdeviceintegrationserver:local .
|
|
#
|
|
# Running `docker build .` from inside this folder will fail fast with a
|
|
# helpful message (the context would be missing the rest of the repo).
|
|
#
|
|
# The final image runs as a non-root user and listens on 0.0.0.0:62542
|
|
# (override host/port via the `host` / `port` environment variables).
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0-azurelinux3.0 AS build
|
|
WORKDIR /src
|
|
|
|
# JIT is disabled for the source generators unless W^X is turned off on
|
|
# some kernels; match the existing ConsoleReferenceServer Dockerfile.
|
|
ENV DOTNET_EnableWriteXorExecute=0
|
|
|
|
# Copy the full repository. The project pulls in many transitive
|
|
# ProjectReferences, a source-generator analyzer, and AdditionalFiles
|
|
# NodeSet2 XML/CSV inputs, so a per-csproj copy list would be fragile.
|
|
COPY . .
|
|
|
|
# Fail fast with a clear message when the build context is not the
|
|
# repository root (UA.slnx is the root marker).
|
|
RUN test -f UA.slnx || { \
|
|
echo ''; \
|
|
echo 'ERROR: build the repository ROOT as the Docker context, not this folder.'; \
|
|
echo ' The image needs the full source tree (src/, src/, tools/).'; \
|
|
echo ''; \
|
|
echo ' From the repository root run:'; \
|
|
echo ' docker build -f samples/DI/PumpDeviceIntegrationServer/Dockerfile -t pumpdeviceintegrationserver .'; \
|
|
echo ''; \
|
|
exit 1; \
|
|
}
|
|
|
|
ARG Version
|
|
ARG SimpleVersion
|
|
ARG InformationalVersion
|
|
|
|
RUN dotnet restore "samples/DI/PumpDeviceIntegrationServer/PumpDeviceIntegrationServer.csproj" \
|
|
--force
|
|
|
|
RUN dotnet publish "samples/DI/PumpDeviceIntegrationServer/PumpDeviceIntegrationServer.csproj" \
|
|
--no-restore \
|
|
-c Release \
|
|
-f net10.0 \
|
|
-p:PublishAot=false \
|
|
-p:Dockerbuild=true \
|
|
-p:Version=${Version} \
|
|
-p:AssemblyVersion=${SimpleVersion} \
|
|
-p:FileVersion=${Version} \
|
|
-p:InformationalVersion=${InformationalVersion} \
|
|
-o /app/publish
|
|
|
|
FROM mcr.microsoft.com/dotnet/runtime:10.0-azurelinux3.0 AS final
|
|
|
|
# AzureLinux forces the SymCrypt OpenSSL provider as the default for all
|
|
# EVP operations (default_properties = "?provider=symcryptprovider" in
|
|
# openssl.cnf). SymCrypt's ECDSA SignHash path rejects the self-signing
|
|
# call the OPC UA stack makes when creating its ECC application-instance
|
|
# certificate ("operation not supported for this keytype"). Clearing the
|
|
# forced default lets the standard OpenSSL default provider handle ECDSA
|
|
# (still fully secure; just not the FIPS-validated SymCrypt module).
|
|
RUN sed -i 's/^default_properties = .*/default_properties = ""/' /etc/pki/tls/openssl.cnf
|
|
|
|
WORKDIR /app
|
|
COPY --from=build /app/publish .
|
|
|
|
# The .NET base images ship a predefined non-root user `app` (UID 1654,
|
|
# exposed via the APP_UID env var). The server creates its
|
|
# certificate/PKI store under /app at runtime. The shared /diag
|
|
# directory carries the diagnostic socket and collected artifacts for
|
|
# the companion Kubernetes diagnostics container.
|
|
ENV HOME=/app \
|
|
DOTNET_DiagnosticPorts=/diag/dotnet-diagnostic.sock,suspend=n,listen
|
|
RUN mkdir -p /app/pki /diag \
|
|
&& chown -R $APP_UID:0 /app /diag \
|
|
&& chmod -R g=u /app /diag
|
|
|
|
USER $APP_UID
|
|
|
|
# Bind to all interfaces so the endpoint is reachable from outside the
|
|
# container. Override with `-e host=...` / `-e port=...`.
|
|
ENV host=0.0.0.0 \
|
|
port=62542
|
|
|
|
EXPOSE 62542
|
|
|
|
ENTRYPOINT ["dotnet", "PumpDeviceIntegrationServer.dll"]
|