From 9b74d3daa015d3be819360e32ccaabb8ae60a487 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Thu, 23 Mar 2017 12:20:03 -0400 Subject: [PATCH 1/3] chmod +x on the git index for build-bits.sh --- cli-mac/build-bits.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 cli-mac/build-bits.sh diff --git a/cli-mac/build-bits.sh b/cli-mac/build-bits.sh old mode 100644 new mode 100755 From 6077f139d541c0447c951d08715e3139698d2f01 Mon Sep 17 00:00:00 2001 From: Matt Ward <(none)> Date: Sun, 16 Jul 2017 12:05:01 +0100 Subject: [PATCH 2/3] Configure packages directory for restored NuGet packages All solutions now restore to the packages directory at the root of the repository. This fixes packages being restored into the src/Mobile/packages directory when the eShopOnContainers.Xamarin.sln is opened. --- NuGet.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NuGet.config b/NuGet.config index ae7699939..da29646ef 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,5 +1,8 @@  + + + From 091ed81e7bf3179344fe74e8135f3e1e866d4f94 Mon Sep 17 00:00:00 2001 From: yanchenw Date: Mon, 27 Nov 2017 13:48:31 -0800 Subject: [PATCH 3/3] Converts to use multi-stage build Dockerfile 1. Changes the build context of all services to the root level to be able to access the dependencies for each project. 2. Commented out the prepublish scripts, these steps are moved into the Dockerfile Did not change any script yet, need help to identify what scripts we need to change. --- .dockerignore | 24 +++++++++++ docker-compose.dcproj | 1 + docker-compose.yml | 40 +++++++++---------- src/Services/Basket/Basket.API/.dockerignore | 3 -- .../Basket/Basket.API/Basket.API.csproj | 9 ----- src/Services/Basket/Basket.API/Dockerfile | 25 ++++++++++-- .../Catalog/Catalog.API/.dockerignore | 3 -- .../Catalog/Catalog.API/Catalog.API.csproj | 3 -- src/Services/Catalog/Catalog.API/Dockerfile | 29 ++++++++++++-- .../Identity/Identity.API/.dockerignore | 3 -- src/Services/Identity/Identity.API/Dockerfile | 25 ++++++++++-- .../Identity/Identity.API/Identity.API.csproj | 3 -- .../Location/Locations.API/.dockerignore | 3 -- .../Location/Locations.API/Dockerfile | 25 ++++++++++-- .../Marketing/Marketing.API/.dockerignore | 3 -- .../Marketing/Marketing.API/Dockerfile | 27 +++++++++++-- .../Marketing.API/Marketing.API.csproj | 3 -- .../Ordering/Ordering.API/.dockerignore | 3 -- src/Services/Ordering/Ordering.API/Dockerfile | 30 ++++++++++++-- .../Ordering/Ordering.API/Ordering.API.csproj | 6 --- .../Payment/Payment.API/.dockerignore | 3 -- src/Services/Payment/Payment.API/Dockerfile | 27 +++++++++++-- .../Catalog.WebForms/Catalog.WebForms.csproj | 3 -- src/Web/WebMVC/.dockerignore | 3 -- src/Web/WebMVC/Dockerfile | 26 ++++++++++-- src/Web/WebMVC/WebMVC.csproj | 12 ++---- src/Web/WebMonolithic/eShopWeb/.dockerignore | 3 -- src/Web/WebSPA/.dockerignore | 3 -- src/Web/WebSPA/Dockerfile | 26 ++++++++++-- src/Web/WebSPA/WebSPA.csproj | 10 +---- src/Web/WebSPA/package-lock.json | 30 +++++++------- src/Web/WebStatus/.dockerignore | 3 -- src/Web/WebStatus/Dockerfile | 22 ++++++++-- 33 files changed, 297 insertions(+), 142 deletions(-) create mode 100644 .dockerignore delete mode 100644 src/Services/Basket/Basket.API/.dockerignore delete mode 100644 src/Services/Catalog/Catalog.API/.dockerignore delete mode 100644 src/Services/Identity/Identity.API/.dockerignore delete mode 100644 src/Services/Location/Locations.API/.dockerignore delete mode 100644 src/Services/Marketing/Marketing.API/.dockerignore delete mode 100644 src/Services/Ordering/Ordering.API/.dockerignore delete mode 100644 src/Services/Payment/Payment.API/.dockerignore delete mode 100644 src/Web/WebMVC/.dockerignore delete mode 100644 src/Web/WebMonolithic/eShopWeb/.dockerignore delete mode 100644 src/Web/WebSPA/.dockerignore delete mode 100644 src/Web/WebStatus/.dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..37e211fa2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +.dockerignore +.env +.git +.gitignore +.vs +.vscode +docker-compose.yml +docker-compose.*.yml +vsts-docs +test +ServiceFabric +readme +k8s +img +docs +deploy +Components +cli-windows +cli-mac +cli-linux +**/bin/ +**/obj/ +**/node_modules/ +**/bower_components/ \ No newline at end of file diff --git a/docker-compose.dcproj b/docker-compose.dcproj index 23547b577..ccdc2195a 100644 --- a/docker-compose.dcproj +++ b/docker-compose.dcproj @@ -9,6 +9,7 @@ 2.0 + docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index 1c854c998..f37277bc3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,8 @@ services: basket.api: image: eshop/basket.api:${TAG:-latest} build: - context: ./src/Services/Basket/Basket.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Basket/Basket.API/Dockerfile depends_on: - basket.data - identity.api @@ -15,8 +15,8 @@ services: catalog.api: image: eshop/catalog.api:${TAG:-latest} build: - context: ./src/Services/Catalog/Catalog.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Catalog/Catalog.API/Dockerfile depends_on: - sql.data - rabbitmq @@ -24,16 +24,16 @@ services: identity.api: image: eshop/identity.api:${TAG:-latest} build: - context: ./src/Services/Identity/Identity.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Identity/Identity.API/Dockerfile depends_on: - sql.data ordering.api: image: eshop/ordering.api:${TAG:-latest} build: - context: ./src/Services/Ordering/Ordering.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Ordering/Ordering.API/Dockerfile depends_on: - sql.data - rabbitmq @@ -41,8 +41,8 @@ services: marketing.api: image: eshop/marketing.api:${TAG:-latest} build: - context: ./src/Services/Marketing/Marketing.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Marketing/Marketing.API/Dockerfile depends_on: - sql.data - nosql.data @@ -52,8 +52,8 @@ services: webspa: image: eshop/webspa:${TAG:-latest} build: - context: ./src/Web/WebSPA - dockerfile: Dockerfile + context: . + dockerfile: ./src/Web/WebSPA/Dockerfile depends_on: - catalog.api - ordering.api @@ -64,8 +64,8 @@ services: webmvc: image: eshop/webmvc:${TAG:-latest} build: - context: ./src/Web/WebMVC - dockerfile: Dockerfile + context: . + dockerfile: ./src/Web/WebMVC/Dockerfile depends_on: - catalog.api - ordering.api @@ -76,22 +76,22 @@ services: webstatus: image: eshop/webstatus:${TAG:-latest} build: - context: ./src/Web/WebStatus - dockerfile: Dockerfile + context: . + dockerfile: ./src/Web/WebStatus/Dockerfile payment.api: image: eshop/payment.api:${TAG:-latest} build: - context: ./src/Services/Payment/Payment.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Payment/Payment.API/Dockerfile depends_on: - rabbitmq locations.api: image: eshop/locations.api:${TAG:-latest} build: - context: ./src/Services/Location/Locations.API - dockerfile: Dockerfile + context: . + dockerfile: ./src/Services/Location/Locations.API/Dockerfile depends_on: - nosql.data - rabbitmq diff --git a/src/Services/Basket/Basket.API/.dockerignore b/src/Services/Basket/Basket.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Basket/Basket.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 48d32de2a..f0ae48824 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -10,9 +10,6 @@ PreserveNewest - - PreserveNewest - @@ -33,10 +30,4 @@ - - - Always - - - diff --git a/src/Services/Basket/Basket.API/Dockerfile b/src/Services/Basket/Basket.API/Dockerfile index 2e7395520..5e479cde0 100644 --- a/src/Services/Basket/Basket.API/Dockerfile +++ b/src/Services/Basket/Basket.API/Dockerfile @@ -1,6 +1,25 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Basket/Basket.API/Basket.API.csproj src/Services/Basket/Basket.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Basket/Basket.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/Catalog/Catalog.API/.dockerignore b/src/Services/Catalog/Catalog.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Catalog/Catalog.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index f5aec67ad..05d2ff61c 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -61,9 +61,6 @@ - - Always - PreserveNewest diff --git a/src/Services/Catalog/Catalog.API/Dockerfile b/src/Services/Catalog/Catalog.API/Dockerfile index 0f5d934d2..498263786 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile +++ b/src/Services/Catalog/Catalog.API/Dockerfile @@ -1,6 +1,29 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Catalog/Catalog.API/Catalog.API.csproj src/Services/Catalog/Catalog.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj src/BuildingBlocks/EventBus/IntegrationEventLogEF/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +COPY src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj src/BuildingBlocks/WebHostCustomization/WebHost.Customization/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Catalog/Catalog.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Catalog.API.dll"] diff --git a/src/Services/Identity/Identity.API/.dockerignore b/src/Services/Identity/Identity.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Identity/Identity.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Identity/Identity.API/Dockerfile b/src/Services/Identity/Identity.API/Dockerfile index 029b5893e..e50625cf2 100644 --- a/src/Services/Identity/Identity.API/Dockerfile +++ b/src/Services/Identity/Identity.API/Dockerfile @@ -1,6 +1,25 @@ -FROM microsoft/aspnetcore:2.0.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Identity/Identity.API/Identity.API.csproj src/Services/Identity/Identity.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj src/BuildingBlocks/DataProtection/DataProtection/ +COPY src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj src/BuildingBlocks/WebHostCustomization/WebHost.Customization/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Identity/Identity.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Identity.API.dll"] diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 8d761b9ed..94e5b0bb3 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -51,9 +51,6 @@ - - Always - PreserveNewest diff --git a/src/Services/Location/Locations.API/.dockerignore b/src/Services/Location/Locations.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Location/Locations.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Location/Locations.API/Dockerfile b/src/Services/Location/Locations.API/Dockerfile index 5a5edb3e7..56bef128d 100644 --- a/src/Services/Location/Locations.API/Dockerfile +++ b/src/Services/Location/Locations.API/Dockerfile @@ -1,6 +1,25 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Location/Locations.API/Locations.API.csproj src/Services/Location/Locations.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Location/Locations.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Locations.API.dll"] diff --git a/src/Services/Marketing/Marketing.API/.dockerignore b/src/Services/Marketing/Marketing.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Marketing/Marketing.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Marketing/Marketing.API/Dockerfile b/src/Services/Marketing/Marketing.API/Dockerfile index bae6435ed..9c5ba08e2 100644 --- a/src/Services/Marketing/Marketing.API/Dockerfile +++ b/src/Services/Marketing/Marketing.API/Dockerfile @@ -1,6 +1,27 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Marketing/Marketing.API/Marketing.API.csproj src/Services/Marketing/Marketing.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +COPY src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj src/BuildingBlocks/WebHostCustomization/WebHost.Customization/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Marketing/Marketing.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Marketing.API.dll"] diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 373bda483..6e61604c7 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -45,9 +45,6 @@ - - Always - PreserveNewest diff --git a/src/Services/Ordering/Ordering.API/.dockerignore b/src/Services/Ordering/Ordering.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Ordering/Ordering.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Ordering/Ordering.API/Dockerfile b/src/Services/Ordering/Ordering.API/Dockerfile index c7386bb43..601e0836b 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile +++ b/src/Services/Ordering/Ordering.API/Dockerfile @@ -1,6 +1,30 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Ordering/Ordering.API/Ordering.API.csproj src/Services/Ordering/Ordering.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj src/BuildingBlocks/EventBus/IntegrationEventLogEF/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj src/Services/Ordering/Ordering.Domain/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +COPY src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj src/BuildingBlocks/WebHostCustomization/WebHost.Customization/ +COPY src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj src/Services/Ordering/Ordering.Infrastructure/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Ordering/Ordering.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Ordering.API.dll"] diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 9dee34091..16eb6e57f 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -11,9 +11,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -54,9 +51,6 @@ - - Always - PreserveNewest diff --git a/src/Services/Payment/Payment.API/.dockerignore b/src/Services/Payment/Payment.API/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/Payment/Payment.API/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/Payment/Payment.API/Dockerfile b/src/Services/Payment/Payment.API/Dockerfile index 9f7491a16..eacf572d6 100644 --- a/src/Services/Payment/Payment.API/Dockerfile +++ b/src/Services/Payment/Payment.API/Dockerfile @@ -1,6 +1,27 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Services/Payment/Payment.API/Payment.API.csproj src/Services/Payment/Payment.API/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj src/BuildingBlocks/EventBus/IntegrationEventLogEF/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Services/Payment/Payment.API +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "Payment.API.dll"] diff --git a/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj b/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj index 391983c31..aa829a4c8 100644 --- a/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj +++ b/src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj @@ -150,9 +150,6 @@ PreserveNewest - - Dockerfile - diff --git a/src/Web/WebMVC/.dockerignore b/src/Web/WebMVC/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Web/WebMVC/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index 729620bb9..0b2ab744f 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -1,6 +1,26 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Web/WebMVC/WebMVC.csproj src/Web/WebMVC/ +COPY src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj src/BuildingBlocks/DataProtection/DataProtection/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +COPY src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj src/BuildingBlocks/Resilience/Resilience.Http/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Web/WebMVC +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN bower install --allow-root +RUN dotnet bundle +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebMVC.dll"] diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 47603f10f..479b21f27 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -27,10 +27,10 @@ - - + @@ -45,12 +45,6 @@ - - - Always - - - diff --git a/src/Web/WebMonolithic/eShopWeb/.dockerignore b/src/Web/WebMonolithic/eShopWeb/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Web/WebMonolithic/eShopWeb/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Web/WebSPA/.dockerignore b/src/Web/WebSPA/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Web/WebSPA/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Web/WebSPA/Dockerfile b/src/Web/WebSPA/Dockerfile index f08724dd8..7142d5f4f 100644 --- a/src/Web/WebSPA/Dockerfile +++ b/src/Web/WebSPA/Dockerfile @@ -1,6 +1,26 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Web/WebSPA/WebSPA.csproj src/Web/WebSPA/ +COPY src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj src/BuildingBlocks/DataProtection/DataProtection/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Web/WebSPA +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN npm rebuild node-sass +RUN npm install +RUN npm run build:prod +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebSPA.dll"] diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 308dc5324..fa5a8a8f4 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -36,14 +36,14 @@ - + @@ -66,12 +66,6 @@ - - - Always - - - diff --git a/src/Web/WebSPA/package-lock.json b/src/Web/WebSPA/package-lock.json index bc4b391e9..313a88257 100644 --- a/src/Web/WebSPA/package-lock.json +++ b/src/Web/WebSPA/package-lock.json @@ -9243,15 +9243,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -9263,6 +9254,15 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -10085,12 +10085,6 @@ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "dev": true }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -10118,6 +10112,12 @@ } } }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", diff --git a/src/Web/WebStatus/.dockerignore b/src/Web/WebStatus/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Web/WebStatus/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Web/WebStatus/Dockerfile b/src/Web/WebStatus/Dockerfile index 8d9b70884..f69f0853d 100644 --- a/src/Web/WebStatus/Dockerfile +++ b/src/Web/WebStatus/Dockerfile @@ -1,6 +1,22 @@ -FROM microsoft/aspnetcore:2.0 -ARG source +FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 -COPY ${source:-obj/Docker/publish} . + +FROM microsoft/aspnetcore-build:2.0 AS build +WORKDIR /src +COPY eShopOnContainers-ServicesAndWebApps.sln ./ +COPY src/Web/WebStatus/WebStatus.csproj src/Web/WebStatus/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/ +COPY src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/ +RUN dotnet restore +COPY . . +WORKDIR /src/src/Web/WebStatus +RUN dotnet build -c Release -o /app + +FROM build AS publish +RUN dotnet publish -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebStatus.dll"]