From 29aec6ccf280f5ffa62a2e850b27351cfb5ecab4 Mon Sep 17 00:00:00 2001 From: Hidayat Arghandabi Date: Sun, 15 Oct 2023 13:41:08 +0300 Subject: [PATCH] [Aggregator] Added Dockerization --- .../Shopping.Aggregator/Dockerfile | 19 +++++++++++++++++++ .../Shopping.Aggregator.csproj | 1 + src/docker-compose.yml | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/ApiGateways/Shopping.Aggregator/Dockerfile diff --git a/src/ApiGateways/Shopping.Aggregator/Dockerfile b/src/ApiGateways/Shopping.Aggregator/Dockerfile new file mode 100644 index 0000000..fe3d02f --- /dev/null +++ b/src/ApiGateways/Shopping.Aggregator/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj", "ApiGateways/Shopping.Aggregator/"] +RUN dotnet restore "ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj" +COPY . . +WORKDIR "/src/ApiGateways/Shopping.Aggregator" +RUN dotnet build "Shopping.Aggregator.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Shopping.Aggregator.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Shopping.Aggregator.dll"] \ No newline at end of file diff --git a/src/ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj b/src/ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj index 3d437a6..349d9c3 100644 --- a/src/ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj +++ b/src/ApiGateways/Shopping.Aggregator/Shopping.Aggregator.csproj @@ -4,6 +4,7 @@ net7.0 enable enable + Linux diff --git a/src/docker-compose.yml b/src/docker-compose.yml index e9380f0..3050d8a 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -141,6 +141,24 @@ services: - discount.api - ordering.api + shopping.aggregator: + image: ${DOCKER_REGISTRY-}shoppingaggregator + container_name: shopping.aggregator + environment: + - ASPNETCORE_ENVIRONMENT=Development + - 'ApiSettings:CatalogUrl=http://catalog.api' + - 'ApiSettings:BasketUrl=http://basket.api' + - 'ApiSettings:OrderingUrl=http://ordering.api' + build: + context: . + dockerfile: APIGateways/Shopping.Aggregator/Dockerfile + ports: + - '8005:80' + depends_on: + - catalog.api + - basket.api + - ordering.api + rabbitmq: image: rabbitmq:3-management-alpine container_name: rabbitmq