Skip to content

Commit

Permalink
slim down the final container image (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpmi-13 authored Sep 9, 2024
1 parent b6ecc9c commit 38e4b9e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Huxley2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
RUN dotnet restore --runtime alpine-x64

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
RUN dotnet publish -c Release -o out \
--no-restore \
--runtime alpine-x64 \
--self-contained true \
/p:PublishTrimmed=true \
/p:PublishSingleFile=true


# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Huxley2.dll"]
ENTRYPOINT ["./Huxley2"]

0 comments on commit 38e4b9e

Please sign in to comment.