From 2a50abfcc1a6cba2f18cd970dd8b7723be62f423 Mon Sep 17 00:00:00 2001 From: Alexander Kastil Date: Mon, 2 Sep 2024 10:48:09 +0200 Subject: [PATCH] chore: Update Dockerfiles for improved containerization --- src/services/catalog-service/dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/services/catalog-service/dockerfile b/src/services/catalog-service/dockerfile index a7ab30e8..f6a106f2 100644 --- a/src/services/catalog-service/dockerfile +++ b/src/services/catalog-service/dockerfile @@ -1,19 +1,14 @@ # Build Image FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build -WORKDIR /app - -RUN dotnet restore "catalog-service.csproj" +WORKDIR /build COPY . . -WORKDIR "/app/catalog-service" - -RUN dotnet build "catalog-service.csproj" -c Release -o /app/build -FROM build as publish -RUN dotnet publish "catalog-service.csproj" -c Release -o /app/publish +RUN dotnet restore "catalog-service.csproj" +RUN dotnet publish -c Release -o /app # Runtime Image FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS final WORKDIR /app -COPY --from=publish /app . +COPY --from=build /app . ENTRYPOINT ["dotnet", "catalog-service.dll"] # Build Image