Skip to content

Commit

Permalink
Modifying dockerfile. Suppressing trimming warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsbk committed Aug 20, 2024
1 parent 505c50b commit 727e9f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Linux (default)
ARG BUILD_IMAGE_BASE=mcr.microsoft.com/dotnet/sdk:8.0-alpine
ARG RUNTIME_IMAGE_BASE=mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
ARG RUNTIME_IMAGE_BASE=mcr.microsoft.com/dotnet/runtime:8.0-alpine
# Windows (built out of CI/CD)
# ARG BUILD_IMAGE=mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022
# ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2022
Expand All @@ -19,15 +19,14 @@ WORKDIR /app
COPY . ./
RUN dotnet restore -a $TARGETARCH ./src/$PROJECT_NAME/$PROJECT_NAME.csproj
RUN dotnet publish -a $TARGETARCH \
--no-restore \
--self-contained true \
-c Release \
-o out \
./src/$PROJECT_NAME/$PROJECT_NAME.csproj

# Build the runtime image
FROM --platform=$BUILDPLATFORM ${RUNTIME_IMAGE_BASE}
ARG TARGETARCH
ARG BUILDPLATFORM
FROM ${RUNTIME_IMAGE_BASE}

ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
DOTNET_RUNNING_IN_CONTAINER=true \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- Below settings drastically reduce app size, while improving startup speed -->
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<!-- This reduces memory consumption -->
Expand Down

0 comments on commit 727e9f4

Please sign in to comment.