Optimize multi-stage build Dockerfile

Remove explicitly copied dependencies, copy entire solution
into the conainter and depends on the cache to reduce build
time.

Addd temporary solution file which does not contains the
dcproj file to work around the issue that the dotnet cli
cannot handle dcproj.
This commit is contained in:
yanchenw 2018-01-04 11:01:45 -08:00
parent 505d0f9c16
commit e4fa15b813
23 changed files with 1177 additions and 147 deletions

View File

@ -4,8 +4,14 @@
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
docker-compose*.yml
docker-compose.dcproj
*.sln
!eShopOnContainers-ServicesAndWebApps-MultiStageBuild.sln
*.md
hosts
LICENSE
*.testsettings
vsts-docs
test
ServiceFabric
@ -22,4 +28,5 @@ cli-linux
**/obj/
**/node_modules/
**/bower_components/
**/wwwroot/lib/
global.json

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
services:
sql.data:

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
services:
sql.data:

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:

View File

@ -1,11 +1,11 @@
version: '3'
version: '3.4'
services:
basket.api:
image: eshop/basket.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Basket/Basket.API/Dockerfile
dockerfile: src/Services/Basket/Basket.API/Dockerfile
depends_on:
- basket.data
- identity.api
@ -15,7 +15,7 @@ services:
image: eshop/catalog.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Catalog/Catalog.API/Dockerfile
dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
@ -24,7 +24,7 @@ services:
image: eshop/identity.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Identity/Identity.API/Dockerfile
dockerfile: src/Services/Identity/Identity.API/Dockerfile
depends_on:
- sql.data
@ -32,7 +32,7 @@ services:
image: eshop/ordering.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Ordering/Ordering.API/Dockerfile
dockerfile: src/Services/Ordering/Ordering.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
@ -41,7 +41,7 @@ services:
image: eshop/marketing.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Marketing/Marketing.API/Dockerfile
dockerfile: src/Services/Marketing/Marketing.API/Dockerfile
depends_on:
- sql.data
- nosql.data
@ -52,7 +52,7 @@ services:
image: eshop/webspa-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Web/WebSPA/Dockerfile
dockerfile: src/Web/WebSPA/Dockerfile
depends_on:
- catalog.api
- ordering.api
@ -63,7 +63,7 @@ services:
webmvc:
image: eshop/webmvc-win:${TAG:-latest}
build:
context: ./src/Web/WebMVC
context: src/Web/WebMVC
dockerfile: Dockerfile
depends_on:
- catalog.api
@ -76,13 +76,13 @@ services:
image: eshop/webstatus-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Web/WebStatus/Dockerfile
dockerfile: src/Web/WebStatus/Dockerfile
payment.api:
image: eshop/payment.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Payment/Payment.API/Dockerfile
dockerfile: src/Services/Payment/Payment.API/Dockerfile
depends_on:
- rabbitmq
@ -90,7 +90,7 @@ services:
image: eshop/locations.api-win:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Location/Locations.API/Dockerfile
dockerfile: src/Services/Location/Locations.API/Dockerfile
depends_on:
- nosql.data
- rabbitmq

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
services:
ci-build:

View File

@ -6,7 +6,7 @@
<DockerServiceUrl>http://localhost:5100</DockerServiceUrl>
<DockerServiceName>webmvc</DockerServiceName>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectVersion>2.0</ProjectVersion>
<ProjectVersion>2.1</ProjectVersion>
</PropertyGroup>
<ItemGroup>
<None Include=".dockerignore" />

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
services:
basket.api:

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
# ONLY NEEDED WHEN RUNNING WINDOWS CONTAINERS
#

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.4'
services:
@ -6,7 +6,7 @@ services:
image: eshop/basket.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Basket/Basket.API/Dockerfile
dockerfile: src/Services/Basket/Basket.API/Dockerfile
depends_on:
- basket.data
- identity.api
@ -16,7 +16,7 @@ services:
image: eshop/catalog.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Catalog/Catalog.API/Dockerfile
dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
@ -25,7 +25,7 @@ services:
image: eshop/identity.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Identity/Identity.API/Dockerfile
dockerfile: src/Services/Identity/Identity.API/Dockerfile
depends_on:
- sql.data
@ -33,7 +33,7 @@ services:
image: eshop/ordering.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Ordering/Ordering.API/Dockerfile
dockerfile: src/Services/Ordering/Ordering.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
@ -42,7 +42,7 @@ services:
image: eshop/marketing.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Marketing/Marketing.API/Dockerfile
dockerfile: src/Services/Marketing/Marketing.API/Dockerfile
depends_on:
- sql.data
- nosql.data
@ -53,7 +53,7 @@ services:
image: eshop/webspa:${TAG:-latest}
build:
context: .
dockerfile: ./src/Web/WebSPA/Dockerfile
dockerfile: src/Web/WebSPA/Dockerfile
depends_on:
- catalog.api
- ordering.api
@ -65,7 +65,7 @@ services:
image: eshop/webmvc:${TAG:-latest}
build:
context: .
dockerfile: ./src/Web/WebMVC/Dockerfile
dockerfile: src/Web/WebMVC/Dockerfile
depends_on:
- catalog.api
- ordering.api
@ -77,13 +77,13 @@ services:
image: eshop/webstatus:${TAG:-latest}
build:
context: .
dockerfile: ./src/Web/WebStatus/Dockerfile
dockerfile: src/Web/WebStatus/Dockerfile
payment.api:
image: eshop/payment.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Payment/Payment.API/Dockerfile
dockerfile: src/Services/Payment/Payment.API/Dockerfile
depends_on:
- rabbitmq
@ -91,7 +91,7 @@ services:
image: eshop/locations.api:${TAG:-latest}
build:
context: .
dockerfile: ./src/Services/Location/Locations.API/Dockerfile
dockerfile: src/Services/Location/Locations.API/Dockerfile
depends_on:
- nosql.data
- rabbitmq

File diff suppressed because it is too large Load Diff

View File

@ -4,20 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Basket/Basket.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,24 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Catalog/Catalog.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,19 +4,12 @@ EXPOSE 80
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/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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Identity/Identity.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,20 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Location/Locations.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,22 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Marketing/Marketing.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,25 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Ordering/Ordering.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,22 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Services/Payment/Payment.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,20 +4,14 @@ EXPOSE 80
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/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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
WORKDIR /src/src/Web/WebMVC
RUN bower install --allow-root
RUN dotnet bundle
RUN dotnet publish -c Release -o /app
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,20 +4,15 @@ EXPOSE 80
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/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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
WORKDIR /src/src/Web/WebSPA
RUN npm rebuild node-sass
RUN npm install
RUN npm run build:prod
RUN dotnet publish -c Release -o /app
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app

View File

@ -4,17 +4,12 @@ EXPOSE 80
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
RUN dotnet build -c Release -nowarn:msb3202,nu1503
FROM build AS publish
RUN dotnet publish -c Release -o /app
WORKDIR /src/src/Web/WebStatus
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app