Optimize multistage build

This commit is contained in:
yanchenw 2018-01-04 14:29:17 -08:00
parent 9e8f6329c9
commit 607a30491e
12 changed files with 31 additions and 1128 deletions

View File

@ -7,7 +7,7 @@
docker-compose*.yml
docker-compose.dcproj
*.sln
!eShopOnContainers-ServicesAndWebApps-MultiStageBuild.sln
!eShopOnContainers-ServicesAndWebApps.sln
*.md
hosts
LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Basket/Basket.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Basket/Basket.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Catalog/Catalog.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Catalog/Catalog.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Identity/Identity.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Identity/Identity.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Location/Locations.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Location/Locations.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Marketing/Marketing.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Marketing/Marketing.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Ordering/Ordering.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Ordering/Ordering.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Services/Payment/Payment.API
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Services/Payment/Payment.API
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Web/WebMVC
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Web/WebMVC
RUN bower install --allow-root
RUN dotnet bundle
RUN dotnet publish --no-restore -c Release -o /app

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Web/WebSPA
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Web/WebSPA
RUN npm rebuild node-sass
RUN npm install
RUN npm run build:prod

View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,nu1503
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/Web/WebStatus
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
WORKDIR /src/src/Web/WebStatus
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final