Update C# sample to .Net Core 3.1 (#2022)

* Changed C# sample to use more lean and secure alpine as base image

* Updated sample to use .NET Core 3.0

* Fixed typos in README.md

* Fixed indentation

* Updated C# sample to .Net Core 3.1
This commit is contained in:
Mete Atamel 2020-01-14 16:07:05 +00:00 committed by Knative Prow Robot
parent a183833f19
commit 951a867f6f
3 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# Use Microsoft's official build .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-sdk/
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-alpine AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
# Install production dependencies.
@ -18,7 +18,7 @@ RUN dotnet publish -c Release -o out
# Use Microsoft's official runtime .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-aspnet/
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-alpine AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
WORKDIR /app
COPY --from=build /app/out ./

View File

@ -5,7 +5,7 @@ weight: 1
type: "docs"
---
A simple web app written in C# using .NET Core 3.0 that you can use for testing.
A simple web app written in C# using .NET Core 3.1 that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello \${TARGET}!". If TARGET
is not specified, it will use "World" as the TARGET.
@ -25,16 +25,16 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-csharp
create one.
- [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry).
- You have installed [.NET Core SDK 3.0](https://www.microsoft.com/net/core).
- You have installed [.NET Core SDK 3.1](https://www.microsoft.com/net/core).
## Recreating the sample code
1. First, make sure you have
[.NET Core SDK 3.0](https://www.microsoft.com/net/core) installed:
[.NET Core SDK 3.1](https://www.microsoft.com/net/core) installed:
```shell
dotnet --version
3.0.100
3.1.100
```
1. From the console, create a new empty web project using the dotnet command:
@ -82,7 +82,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-csharp
```docker
# Use Microsoft's official build .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-sdk/
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-alpine AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
# Install production dependencies.
@ -99,7 +99,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-csharp
# Use Microsoft's official runtime .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-aspnet/
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-alpine AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
WORKDIR /app
COPY --from=build /app/out ./

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>helloworld_csharp</RootNamespace>
</PropertyGroup>