From a27400928ae0ef10ea7835b5cf87731e4516d2d1 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Thu, 11 Dec 2025 01:19:06 +0000 Subject: [PATCH] feat: upgrade to dotnet 10 --- .devcontainer/devcontainer.json | 2 +- Backbone.csproj | 3 +-- Backbone.sln | 22 ---------------------- Backbone.slnx | 3 +++ Dockerfile | 27 +++++++++++++-------------- README.md | 5 ++++- 6 files changed, 22 insertions(+), 40 deletions(-) delete mode 100644 Backbone.sln create mode 100644 Backbone.slnx diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9df588b..ac453c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "Backbone", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-noble", + "image": "mcr.microsoft.com/devcontainers/dotnet:1-10.0-noble", // Features to add to the dev container. More info: https://containers.dev/features. "features": { diff --git a/Backbone.csproj b/Backbone.csproj index f44f31a..1dbae47 100644 --- a/Backbone.csproj +++ b/Backbone.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable false @@ -15,4 +15,3 @@ - diff --git a/Backbone.sln b/Backbone.sln deleted file mode 100644 index 71b4599..0000000 --- a/Backbone.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backbone", "Backbone.csproj", "{79FCBBD5-0D12-4E24-BADC-FC5C2613774C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {79FCBBD5-0D12-4E24-BADC-FC5C2613774C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {79FCBBD5-0D12-4E24-BADC-FC5C2613774C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {79FCBBD5-0D12-4E24-BADC-FC5C2613774C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {79FCBBD5-0D12-4E24-BADC-FC5C2613774C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Backbone.slnx b/Backbone.slnx new file mode 100644 index 0000000..95689ea --- /dev/null +++ b/Backbone.slnx @@ -0,0 +1,3 @@ + + + diff --git a/Dockerfile b/Dockerfile index 27234cf..f9780f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,20 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build +# Build stage +FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine-aot AS build WORKDIR /build -# Installing additional dev dependencies for AOT -RUN apk add clang binutils musl-dev build-base zlib-static +ADD --link . . +RUN --mount=type=cache,target=/root/.nuget \ + --mount=type=cache,target=/build/obj \ + --mount=type=cache,target=/build/bin \ + dotnet publish --runtime linux-musl-x64 --configuration Release --output /out \ + && rm /out/*.dbg /out/*.endpoints.json /out/appsettings.Development.json -ADD *.csproj . -RUN dotnet restore --runtime linux-musl-x64 - -ADD . ./ -RUN dotnet publish --configuration Release --no-restore --output /out - -FROM scratch AS prod +# Production stage +FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine AS prod WORKDIR /app -COPY --from=build /out/Backbone . -COPY --from=build /out/appsettings*.json . +COPY --link --from=build /out/Backbone . -EXPOSE 80 +USER $APP_UID +EXPOSE 8080 ENTRYPOINT [ "./Backbone" ] -CMD [ "--urls", "http://*:80" ] diff --git a/README.md b/README.md index d092b8e..0912a50 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,10 @@ dotnet build # Build the project for production To build a Docker image, run: ```bash -docker build -t . +docker build -t backbone:latest . + +# To run the Docker container: +docker run -d -p 8080:8080 --name backbone_server backbone:latest ``` > [!TIP]