Skip to content

Commit

Permalink
cartservice - .NET 6 (GoogleCloudPlatform#629)
Browse files Browse the repository at this point in the history
* dotnet6.0

* dotnet6.0

* .NET 6 introduces a new hosting model

* update dotnet6 in CI host too

* Fix unit tests
  • Loading branch information
mathieu-benoit authored Nov 23, 2021
1 parent 555eea0 commit df3b2f9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.201'
dotnet-version: '6.0.100'
- name: Go Unit Tests
timeout-minutes: 10
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0
sudo apt-get install -y dotnet-sdk-6.0
echo "✅ dotnet installed"

# install kubectl
Expand Down
4 changes: 2 additions & 2 deletions src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# limitations under the License.

# https://mcr.microsoft.com/v2/dotnet/sdk/tags/list
FROM mcr.microsoft.com/dotnet/sdk:5.0.402 as builder
FROM mcr.microsoft.com/dotnet/sdk:6.0.100 as builder
WORKDIR /app
COPY cartservice.csproj .
RUN dotnet restore cartservice.csproj -r linux-musl-x64
COPY . .
RUN dotnet publish cartservice.csproj -p:PublishSingleFile=true -r linux-musl-x64 --self-contained true -p:PublishTrimmed=True -p:TrimMode=Link -c release -o /cartservice --no-restore

# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list
FROM mcr.microsoft.com/dotnet/runtime-deps:5.0.11-alpine3.14-amd64
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.0-alpine3.14-amd64
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.6 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
Expand Down
4 changes: 2 additions & 2 deletions src/cartservice/src/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
COPY . .
RUN dotnet restore cartservice.csproj
Expand All @@ -22,7 +22,7 @@ FROM build AS publish
RUN dotnet publish cartservice.csproj -c Debug -o /out

# Building final image used in running container
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS final
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
# Installing procps on the container to enable debugging of .NET Core
RUN apt-get update \
&& apt-get install -y unzip procps wget
Expand Down
2 changes: 1 addition & 1 deletion src/cartservice/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ static IHostBuilder CreateHostBuilder(string[] args) =>
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
});
8 changes: 4 additions & 4 deletions src/cartservice/src/cartservice.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
<PackageReference Include="Grpc.HealthCheck" Version="2.41.1" />
<PackageReference Include="StackExchange.Redis" Version="2.2.79" />
<PackageReference Include="Grpc.AspNetCore" Version="2.41.0-pre1" />
<PackageReference Include="Grpc.HealthCheck" Version="2.42.0" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/cartservice/tests/cartservice.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.40.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.11" />
<PackageReference Include="Grpc.Net.Client" Version="2.41.0-pre1" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
Expand Down

0 comments on commit df3b2f9

Please sign in to comment.