-
Notifications
You must be signed in to change notification settings - Fork 937
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ref server docker build (#2035)
- complete build in Dockerfile, not in ci pipeline - Use recommended build tasks for github actions - build multiarch with linux/amd64,linux/arm64 - docker signing support with cosign (yet disabled)
- Loading branch information
Showing
9 changed files
with
168 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
FROM mcr.microsoft.com/dotnet/runtime:6.0 | ||
FROM mcr.microsoft.com/dotnet/runtime:6.0-bullseye-slim AS base | ||
WORKDIR /app | ||
|
||
COPY ./publish /publish | ||
WORKDIR /publish | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build | ||
WORKDIR /src | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY *.* . | ||
COPY ["Applications/ConsoleReferenceServer/ConsoleReferenceServer.csproj", "Applications/ConsoleReferenceServer/"] | ||
COPY ["Stack/Opc.Ua.Core/Opc.Ua.Core.csproj", "Stack/Opc.Ua.Core/"] | ||
COPY ["Libraries/Opc.Ua.Security.Certificates/Opc.Ua.Security.Certificates.csproj", "Libraries/Opc.Ua.Security.Certificates/"] | ||
COPY ["Libraries/Opc.Ua.Configuration/Opc.Ua.Configuration.csproj", "Libraries/Opc.Ua.Configuration/"] | ||
COPY ["Libraries/Opc.Ua.Server/Opc.Ua.Server.csproj", "Libraries/Opc.Ua.Server/"] | ||
COPY ["Applications/Quickstarts.Servers/Quickstarts.Servers.csproj", "Applications/Quickstarts.Servers/"] | ||
RUN dotnet restore "Applications/ConsoleReferenceServer/ConsoleReferenceServer.csproj" -p:NoHttps=true | ||
COPY . . | ||
|
||
WORKDIR "/src/Applications/ConsoleReferenceServer" | ||
ARG Version | ||
ARG SimpleVersion | ||
ARG InformationalVersion | ||
ENV OPTIONS="-c Release -f net6.0 -p:NoHttps=true -p:Dockerbuild=true -p:Version=${Version} -p:AssemblyVersion=${SimpleVersion} -p:FileVersion=${Version} -p:InformationalVersion=${InformationalVersion}" | ||
RUN dotnet build "ConsoleReferenceServer.csproj" --no-restore ${OPTIONS} -o /app/build | ||
|
||
FROM build AS publish | ||
RUN dotnet publish "ConsoleReferenceServer.csproj" ${OPTIONS} -o /app/publish | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
EXPOSE 62541 | ||
ENTRYPOINT ["dotnet", "ConsoleReferenceServer.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
REM build a docker container of the console reference server | ||
set buildoptions=--configuration Release -p:NoHttps=true --framework net6.0 | ||
dotnet build %buildoptions% ConsoleReferenceServer.csproj | ||
dotnet publish %buildoptions% ConsoleReferenceServer.csproj -o ./publish | ||
docker build -f Dockerfile -t consolerefserver . | ||
dotnet tool install --global nbgv | ||
for /f "delims=" %%a in ('nbgv get-version -v Version') do @set Version=%%a | ||
for /f "delims=" %%a in ('nbgv get-version -v SimpleVersion') do @set SimpleVersion=%%a | ||
for /f "delims=" %%a in ('nbgv get-version -v AssemblyInformationalVersion') do @set InformationalVersion=%%a | ||
echo Version Info for docker build: %Version% %SimpleVersion% %InformationalVersion% | ||
docker build --build-arg Version=%Version% --build-arg SimpleVersion=%SimpleVersion% --build-arg InformationalVersion=%InformationalVersion% -f .\Dockerfile -t consolerefserver .\..\.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/bin/bash | ||
echo build a docker container of the .NET Core reference server, without https support | ||
buildoptions="--configuration Release -p:NoHttps=true --framework net6.0" | ||
dotnet build $buildoptions ConsoleReferenceServer.csproj | ||
dotnet publish $buildoptions ConsoleReferenceServer.csproj -o ./publish | ||
sudo docker build -f Dockerfile -t consolerefserver . | ||
sudo docker build -f Dockerfile -t consolerefserver ./../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters