Skip to content

Commit

Permalink
Change production image to be chiseled.
Browse files Browse the repository at this point in the history
  • Loading branch information
NCarlsonMSFT committed Jan 11, 2024
1 parent 51e342a commit 5fe5668
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ChiseledExample/ChiseledExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<!-- Always use Fast mode as Regular mode will use the Chiseled image that doesn't support debugging. -->
<ContainerDevelopmentMode>Fast</ContainerDevelopmentMode>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions ChiseledExample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
# This stage will be used for debugging and as such is based on the full Ubuntu image
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS debug
USER app
WORKDIR /app

Expand All @@ -17,7 +18,9 @@ FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ChiseledExample.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
# This stage will be used for production and as such is based on the chiseled Ubuntu image
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS final
USER app
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ChiseledExample.dll"]

0 comments on commit 5fe5668

Please sign in to comment.