Deployment, Cloud and Serverless

Cloud: Azure (App Service, Functions, Container Apps), AWS (Lambda with the .NET runtime, ECS), Google Cloud Run, and Kubernetes. Infrastructure as code in F#: Farmer (Azure ARM DSL) and Pulumi (supports F#).

CI: GitHub Actions actions/setup-dotnet, dotnet restore/build/test, Fantomas check (dotnet fantomas --check .), and code coverage.

dotnet publish -c Release -o out                                   # framework-dependent
dotnet publish -c Release -r linux-x64 --self-contained -o out      # self-contained
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true    # single-file executable
dotnet publish -c Release -r linux-x64 -p:PublishAot=true           # Native AOT (check library compatibility)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY *.fsproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyApp.dll"]
// Azure Functions (isolated worker) in F#
open Microsoft.Azure.Functions.Worker
open Microsoft.Azure.Functions.Worker.Http
open System.Net

[<Function("Hello")>]
let hello ([<HttpTrigger(AuthorizationLevel.Anonymous, "get")>] req: HttpRequestData) =
    let resp = req.CreateResponse(HttpStatusCode.OK)
    resp.WriteString("Hello from F# Azure Functions")
    resp