Skip to content

Commit

Permalink
Merge pull request #17 from seesharprun/dotnet-8
Browse files Browse the repository at this point in the history
Migrate to .NET 8
  • Loading branch information
seesharprun authored Oct 24, 2023
2 parents 31c532c + f244a1c commit b6ef4dc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ARG VARIANT=7.0
ARG VARIANT=8.0
FROM mcr.microsoft.com/dotnet/sdk:${VARIANT}
ENV PATH $PATH:/home/vscode/.dotnet:/home/vscode/.dotnet/tools
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
name: Validate .NET solution
uses: Azure-Samples/code-validation/.github/workflows/dotnet.yml@main
with:
version: '7.0'
version: '8.0'
working-directory: './src'
secrets: inherit
1 change: 1 addition & 0 deletions infra/app/web.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module containerAppsApp '../core/host/container-apps/app.bicep' = {
secretRef: 'azure-managed-identity-client-id'
}
]
targetPort: 8080
enableSystemAssignedManagedIdentity: false
userAssignedManagedIdentityIds: [
userAssignedManagedIdentity.resourceId
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ When you are finished, you will have a fully functional web application deployed
The following prerequisites are required to use this application. Please ensure that you have them all installed locally.

- [Azure Developer CLI](https://aka.ms/azd-install)
- [.NET SDK 7.0](https://dotnet.microsoft.com/download/dotnet/7.0)
- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0)

### Quickstart

Expand Down
3 changes: 1 addition & 2 deletions src/web/Cosmos.Samples.NoSQL.Quickstart.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>65c85440-31fd-4394-ae83-614ffddbb71f</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UseRazorSourceGenerator>false</UseRazorSourceGenerator>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.*" />
Expand Down
18 changes: 11 additions & 7 deletions src/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["web/Cosmos.Samples.NoSQL.Quickstart.Web.csproj", "web/"]
RUN dotnet restore "web/Cosmos.Samples.NoSQL.Quickstart.Web.csproj"
RUN dotnet restore "./web/./Cosmos.Samples.NoSQL.Quickstart.Web.csproj"
COPY . .
WORKDIR "/src/web"
RUN dotnet build "Cosmos.Samples.NoSQL.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet build "./Cosmos.Samples.NoSQL.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
RUN dotnet publish "Cosmos.Samples.NoSQL.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Cosmos.Samples.NoSQL.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
Expand Down

0 comments on commit b6ef4dc

Please sign in to comment.