Skip to content

Commit e61f849

Browse files
authored
Update to .NET 8 (#2)
* chore: replace Giraffe master branch references by main branch * feat: update F# project to .NET 8 * chore: update dockerfile to use .NET 8 SDK image * chore: start using .NET 8 in CI * chore: update RELEASE_NOTES * add ASPNETCORE_HTTP_PORTS to Dockerfile so we can keep listening at port 80 * revert container port to use the default 5000 * revert the Program.fs links to use the master branch * update RELEASE_NOTES.md
1 parent cd01756 commit e61f849

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup .NET Core
1818
uses: actions/setup-dotnet@v4
1919
with:
20-
dotnet-version: 5.x
20+
dotnet-version: 8.x
2121
- name: Restore
2222
run: dotnet restore src/Giraffe.Website/Giraffe.Website.fsproj
2323
- name: Build

RELEASE_NOTES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Release Notes
22
=============
33

4+
## 1.6.0
5+
6+
- [Minor CSS change](https://github.com/giraffe-fsharp/giraffe-website/pull/3) - Credits @m-rinaldi
7+
- [(CI) GitHub actions version update](https://github.com/giraffe-fsharp/giraffe-website/pull/5) - Credits @64J0
8+
- [Update to .NET 8](https://github.com/giraffe-fsharp/giraffe-website/pull/2) - Credits @64J0
9+
410
## 1.5.0
511

612
CSS changes.

src/Giraffe.Website/Common.fs

+4-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ module NetworkExtensions =
216216
type IApplicationBuilder with
217217
member this.UseTrailingSlashRedirection() =
218218
this.Use(
219-
fun ctx next ->
219+
fun (ctx: HttpContext) (next: RequestDelegate) ->
220220
let hasTrailingSlash =
221221
ctx.Request.Path.HasValue
222222
&& ctx.Request.Path.Value.EndsWith "/"
@@ -229,13 +229,13 @@ module NetworkExtensions =
229229
let url = Microsoft.AspNetCore.Http.Extensions.UriHelper.GetEncodedUrl ctx.Request
230230
ctx.Response.Redirect(url, true)
231231
Threading.Tasks.Task.CompletedTask
232-
| false -> next.Invoke())
232+
| false -> next.Invoke(ctx))
233233

234234
member this.UseHttpsRedirection (isEnabled : bool, domainName : string) =
235235
match isEnabled with
236236
| true ->
237237
this.Use(
238-
fun ctx next ->
238+
fun (ctx: HttpContext) (next: RequestDelegate) ->
239239
let host = ctx.Request.Host.Host
240240
// Only HTTPS redirect for the chosen domain:
241241
let mustUseHttps =
@@ -246,7 +246,7 @@ module NetworkExtensions =
246246
if not mustUseHttps then
247247
ctx.Request.Scheme <- "https"
248248
ctx.Request.IsHttps <- true
249-
next.Invoke())
249+
next.Invoke(ctx))
250250
.UseHttpsRedirection()
251251
| false -> this
252252

src/Giraffe.Website/Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
22

33
ARG version=0.0.0-undefined
44

@@ -9,7 +9,11 @@ COPY src/ ./
99
RUN dotnet publish /p:Version=$version Giraffe.Website/Giraffe.Website.fsproj -c Release -o published
1010

1111
# Build runtime image
12-
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine AS runtime
12+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS runtime
13+
14+
# Change the HTTP port that the server process is listening
15+
# https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/aspnet-port
16+
ENV ASPNETCORE_HTTP_PORTS=5000
1317

1418
WORKDIR /app
1519
COPY --from=build /app/published .

src/Giraffe.Website/Giraffe.Website.fsproj

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<RollForward>Major</RollForward>
66
<EnableDefaultContentItems>false</EnableDefaultContentItems>
77
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Giraffe" Version="5.0.0" />
12-
<PackageReference Include="Giraffe.ViewEngine" Version="1.3.*" />
13-
<PackageReference Include="Ply" Version="0.3.*" />
11+
<PackageReference Include="Giraffe" Version="6.4.0" />
12+
<PackageReference Include="Giraffe.ViewEngine" Version="1.4.0" />
1413
<PackageReference Include="Logfella" Version="7.1.*" />
1514
<PackageReference Include="Sentry.AspNetCore" Version="2.1.*" />
1615
<PackageReference Include="Markdig" Version="0.22.*" />

src/Giraffe.Website/Program.fs

-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ module WebApp =
209209
open System.Net.Http
210210
open Microsoft.Extensions.Logging
211211
open Microsoft.Net.Http.Headers
212-
open FSharp.Control.Tasks
213212
open Giraffe
214213
open Giraffe.EndpointRouting
215214
open Giraffe.ViewEngine

0 commit comments

Comments
 (0)