Compare commits

...

2 Commits

Author SHA1 Message Date
8669904edd
Use new static assets middleware
All checks were successful
Docker Image CI / build (push) Successful in 2m8s
2024-07-12 00:45:34 +01:00
2f5212f8d0
Update to .NET 9 preview 2024-07-11 22:47:19 +01:00
5 changed files with 13 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.7-labs
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build1
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview-alpine AS build1
WORKDIR /src
COPY ./.config ./
@ -10,7 +10,7 @@ WORKDIR Groceries
COPY ./Groceries/libman.json ./
RUN dotnet libman restore
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build2
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview-alpine AS build2
WORKDIR /src
COPY ./Groceries.sln ./
@ -23,7 +23,7 @@ COPY . ./
COPY --from=build1 /src ./
RUN dotnet publish --no-restore --output /out
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-composite AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0-preview-alpine-composite AS base
WORKDIR /groceries
COPY --from=build2 /out .

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>

View File

@ -9,10 +9,12 @@
<meta name="view-transition" content="same-origin" />
<meta name="turbo-prefetch" content="false" />
<link rel="stylesheet" type="text/css" href="/css/main.css" asp-append-version="true" data-turbo-track="reload" />
<link rel="stylesheet" type="text/css" href="@Assets["css/main.css"]" data-turbo-track="reload" />
<script type="module" src="/js/main.js" asp-append-version="true" data-turbo-track="reload"></script>
<script type="module" src="/lib/hotwired/turbo/dist/turbo.es2017-esm.js"></script>
<ImportMap />
<script type="module" src="@Assets["js/main.js"]" data-turbo-track="reload"></script>
<script type="module" src="@Assets["lib/hotwired/turbo/dist/turbo.es2017-esm.js"]"></script>
<HeadOutlet />
</head>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>

View File

@ -51,11 +51,12 @@ builder.Services.AddDbContextPool<AppDbContext>(options => options
var app = builder.Build();
app.UseStaticFiles();
app.UseRouting();
app.UseSession();
app.MapControllers();
app.MapStaticAssets();
app.MapControllers()
.WithStaticAssets();
await app.RunAsync();