-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docker): build image with ASP.NET Core support for Native AOT (…
…~28.7MB)
- Loading branch information
Showing
7 changed files
with
53 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | ||
# https://mcr.microsoft.com/product/dotnet/sdk | ||
# https://mcr.microsoft.com/v2/dotnet/sdk/tags/list | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0-jammy-aot AS build | ||
ARG TARGETARCH | ||
WORKDIR /source | ||
|
||
COPY src/*.csproj . | ||
RUN dotnet restore | ||
RUN dotnet restore -r linux-$TARGETARCH | ||
|
||
COPY src/. . | ||
RUN dotnet publish --no-restore -c Release -o /app | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as final | ||
RUN dotnet publish -r linux-$TARGETARCH --no-restore -o /app | ||
RUN rm /app/*.dbg /app/*.Development.json | ||
|
||
FROM mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0.6-noble-chiseled-aot as final | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
|
||
ENV PORT 3000 | ||
EXPOSE ${PORT} | ||
|
||
USER 1000 | ||
ENTRYPOINT ["dotnet", "demo-dotnet.dll"] | ||
USER $APP_UID | ||
ENTRYPOINT ["./demo-dotnet"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,15 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:33202", | ||
"sslPort": 44359 | ||
} | ||
}, | ||
"profiles": { | ||
"user_demo_dotnet": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7033;http://localhost:5073", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "releases", | ||
"applicationUrl": "http://localhost:5132", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Use [native AOT deployment](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot?view=aspnetcore-8.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<RootNamespace>demo_dotnet</RootNamespace> | ||
<PublishAot>true</PublishAot> | ||
<InvariantGlobalization>true</InvariantGlobalization> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.31" /> | ||
<PackageReference Include="prometheus-net" Version="5.0.1" /> | ||
<PackageReference Include="prometheus-net.AspNetCore" Version="5.0.1" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> | ||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |