Skip to content

Commit

Permalink
[Aggregator] Added Dockerization
Browse files Browse the repository at this point in the history
  • Loading branch information
hidayatarg committed Oct 15, 2023
1 parent 64cb4e3 commit 29aec6c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ApiGateways/Shopping.Aggregator/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions src/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 29aec6c

Please sign in to comment.