Skip to content

Commit 69ff0b6

Browse files
committed
Dockerfiles with .NET 6
1 parent cd479b2 commit 69ff0b6

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

docker/linux-x64.Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# docker build . -f docker/linux-x64.Dockerfile -t aggregator:linux-x64 --build-arg MAJOR_MINOR_PATCH=1.2.3 --build-arg PRERELEASE_TAG=beta-test-42
2-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
1+
# Sample build
2+
# docker build . -f docker/linux-x64.Dockerfile -t aggregator:linux-x64 --build-arg MAJOR_MINOR_PATCH=1.2.3 --build-arg PRERELEASE_TAG=beta-test-42
3+
# see tags at https://hub.docker.com/_/microsoft-dotnet-sdk/
4+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
35

46
ARG MAJOR_MINOR_PATCH=0.0.0
57
ARG PRERELEASE_TAG=
68
ARG CONFIGURATION=Release
7-
ARG FRAMEWORK=netcoreapp3.1
9+
ARG FRAMEWORK=net6.0
810
ARG RUNTIME_IDENTIFIER=linux-musl-x64
911

1012
COPY ./art /workspace/art
@@ -13,14 +15,15 @@ COPY ./src /workspace/src
1315
WORKDIR /workspace
1416

1517
RUN dotnet restore src/aggregator-host/aggregator-host.csproj
16-
RUN dotnet build -f $FRAMEWORK -r $RUNTIME_IDENTIFIER -c $CONFIGURATION -o build src/aggregator-host/aggregator-host.csproj /p:VersionPrefix=$MAJOR_MINOR_PATCH /p:VersionSuffix=$PRERELEASE_TAG
18+
RUN dotnet build -f $FRAMEWORK -r $RUNTIME_IDENTIFIER -c $CONFIGURATION -o build --no-self-contained src/aggregator-host/aggregator-host.csproj /p:VersionPrefix=$MAJOR_MINOR_PATCH /p:VersionSuffix=$PRERELEASE_TAG
1719
RUN dotnet test --configuration $CONFIGURATION src/unittests-core/unittests-core.csproj \
1820
&& dotnet test --configuration $CONFIGURATION src/unittests-ruleng/unittests-ruleng.csproj
1921

20-
RUN dotnet publish --no-restore -f $FRAMEWORK -r $RUNTIME_IDENTIFIER -c $CONFIGURATION -o out src/aggregator-host/aggregator-host.csproj -p:VersionPrefix=$MAJOR_MINOR_PATCH -p:VersionSuffix=$PRERELEASE_TAG
22+
RUN dotnet publish --no-restore -f $FRAMEWORK -r $RUNTIME_IDENTIFIER -c $CONFIGURATION -o out --no-self-contained src/aggregator-host/aggregator-host.csproj -p:VersionPrefix=$MAJOR_MINOR_PATCH -p:VersionSuffix=$PRERELEASE_TAG
2123

2224

23-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine3.12 AS final
25+
# see tags at https://hub.docker.com/_/microsoft-dotnet-aspnet/
26+
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine3.14 AS final
2427

2528
WORKDIR /app
2629

docker/win-x64.Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# escape=`
22

3-
# docker build . -f docker/win-x64.Dockerfile -t aggregator:win-x64 --build-arg MAJOR_MINOR_PATCH=1.2.3 --build-arg PRERELEASE_TAG=beta-test-42
4-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
3+
# Sample build
4+
# docker build . -f docker/win-x64.Dockerfile -t aggregator:win-x64 --build-arg MAJOR_MINOR_PATCH=1.2.3 --build-arg PRERELEASE_TAG=beta-test-42
5+
# see tags at https://hub.docker.com/_/microsoft-dotnet-sdk/
6+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
57

68
ARG MAJOR_MINOR_PATCH=0.0.0
79
ARG PRERELEASE_TAG=
810
ARG CONFIGURATION=Release
9-
ARG FRAMEWORK=netcoreapp3.1
11+
ARG FRAMEWORK=net6.0
1012
ARG RUNTIME_IDENTIFIER=win-x64
1113

1214
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
@@ -17,16 +19,17 @@ COPY ./src /workspace/src
1719
WORKDIR /workspace
1820

1921
RUN dotnet restore src/aggregator-host/aggregator-host.csproj
20-
RUN dotnet build -f $env:FRAMEWORK -r $env:RUNTIME_IDENTIFIER -c $env:CONFIGURATION -o build src/aggregator-host/aggregator-host.csproj /p:VersionPrefix=$env:MAJOR_MINOR_PATCH /p:VersionSuffix=$env:PRERELEASE_TAG
22+
RUN dotnet build -f $env:FRAMEWORK -r $env:RUNTIME_IDENTIFIER -c $env:CONFIGURATION -o build --no-self-contained src/aggregator-host/aggregator-host.csproj /p:VersionPrefix=$env:MAJOR_MINOR_PATCH /p:VersionSuffix=$env:PRERELEASE_TAG
2123
RUN dotnet test --configuration $env:CONFIGURATION src/unittests-core/unittests-core.csproj `
2224
&& dotnet test --configuration $env:CONFIGURATION src/unittests-ruleng/unittests-ruleng.csproj
2325

24-
RUN dotnet publish --no-restore -f $env:FRAMEWORK -r $env:RUNTIME_IDENTIFIER -c $env:CONFIGURATION -o out src/aggregator-host/aggregator-host.csproj -p:VersionPrefix=$env:MAJOR_MINOR_PATCH -p:VersionSuffix=$env:PRERELEASE_TAG
26+
RUN dotnet publish --no-restore -f $env:FRAMEWORK -r $env:RUNTIME_IDENTIFIER -c $env:CONFIGURATION -o out --no-self-contained src/aggregator-host/aggregator-host.csproj -p:VersionPrefix=$env:MAJOR_MINOR_PATCH -p:VersionSuffix=$env:PRERELEASE_TAG
2527

2628

29+
# see tags at https://hub.docker.com/_/microsoft-dotnet-aspnet/
2730
# 1809 should guarantee compatibility from Server 2019 up
2831
# note that Server 2016 is unsupported https://github.com/dotnet/dotnet-docker/issues/1469
29-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1809 AS final
32+
FROM mcr.microsoft.com/dotnet/aspnet:6.0-nanoserver-1809 AS final
3033

3134
WORKDIR /app
3235

src/aggregator-cli.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aggregator-webshared", "agg
4747
EndProject
4848
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{F0E724A4-A159-4E56-849F-2FE51C9FA7DC}"
4949
ProjectSection(SolutionItems) = preProject
50-
linux-x64.Dockerfile = linux-x64.Dockerfile
51-
win-x64.Dockerfile = win-x64.Dockerfile
50+
..\docker\linux-x64.Dockerfile = ..\docker\linux-x64.Dockerfile
51+
..\docker\win-x64.Dockerfile = ..\docker\win-x64.Dockerfile
5252
EndProjectSection
5353
EndProject
5454
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{72427DCE-8A20-45E5-A5E4-781E7E4C1A34}"

src/aggregator-host/aggregator-host.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<RootNamespace>aggregator_host</RootNamespace>
66
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
77
<!-- AssemblyInfo -->

0 commit comments

Comments
 (0)