Skip to content

Commit

Permalink
Simplify cartservice Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwest committed Dec 19, 2023
1 parent d8ecad7 commit b276ea7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ WORKDIR /usr/src/app/
COPY ./src/cartservice/ ./
COPY ./pb/ ./src/protos/

RUN \
RUNTIME_IDENTIIFER=linux-musl-x64; \
if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \
dotnet restore ./src/cartservice.csproj -v d -r $RUNTIME_IDENTIIFER

RUN \
RUNTIME_IDENTIIFER=linux-musl-x64; \
if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \
dotnet publish ./src/cartservice.csproj -v d -p:PublishSingleFile=true -r $RUNTIME_IDENTIIFER --self-contained true -p:PublishTrimmed=False -p:TrimMode=Link -c Release -o /cartservice --no-restore
RUN dotnet restore ./src/cartservice.csproj -v d -r linux-musl-$TARGETARCH

RUN dotnet publish ./src/cartservice.csproj -v d -r linux-musl-$TARGETARCH --no-restore -o /cartservice

# -----------------------------------------------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions src/cartservice/src/cartservice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<TargetFramework>net8.0</TargetFramework>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<StaticWebAssetsEnabled>false</StaticWebAssetsEnabled>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit b276ea7

Please sign in to comment.