Browse Source

Optimize multistage build

pull/454/head
yanchenw 7 years ago
parent
commit
607a30491e
12 changed files with 31 additions and 1128 deletions
  1. +1
    -1
      .dockerignore
  2. +0
    -1107
      eShopOnContainers-ServicesAndWebApps-MultiStageBuild.sln
  3. +3
    -2
      src/Services/Basket/Basket.API/Dockerfile
  4. +3
    -2
      src/Services/Catalog/Catalog.API/Dockerfile
  5. +3
    -2
      src/Services/Identity/Identity.API/Dockerfile
  6. +3
    -2
      src/Services/Location/Locations.API/Dockerfile
  7. +3
    -2
      src/Services/Marketing/Marketing.API/Dockerfile
  8. +3
    -2
      src/Services/Ordering/Ordering.API/Dockerfile
  9. +3
    -2
      src/Services/Payment/Payment.API/Dockerfile
  10. +3
    -2
      src/Web/WebMVC/Dockerfile
  11. +3
    -2
      src/Web/WebSPA/Dockerfile
  12. +3
    -2
      src/Web/WebStatus/Dockerfile

+ 1
- 1
.dockerignore View File

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


+ 0
- 1107
eShopOnContainers-ServicesAndWebApps-MultiStageBuild.sln
File diff suppressed because it is too large
View File


+ 3
- 2
src/Services/Basket/Basket.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Basket/Basket.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Catalog/Catalog.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Catalog/Catalog.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Identity/Identity.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Identity/Identity.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Location/Locations.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Location/Locations.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Marketing/Marketing.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Marketing/Marketing.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Ordering/Ordering.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Ordering/Ordering.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Services/Payment/Payment.API/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Services/Payment/Payment.API
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


+ 3
- 2
src/Web/WebMVC/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Web/WebMVC
RUN bower install --allow-root RUN bower install --allow-root
RUN dotnet bundle RUN dotnet bundle
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app


+ 3
- 2
src/Web/WebSPA/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Web/WebSPA
RUN npm rebuild node-sass RUN npm rebuild node-sass
RUN npm install RUN npm install
RUN npm run build:prod RUN npm run build:prod


+ 3
- 2
src/Web/WebStatus/Dockerfile View File

@ -5,10 +5,11 @@ EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src WORKDIR /src
COPY . . 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 FROM build AS publish
WORKDIR /src/src/Web/WebStatus
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final


Loading…
Cancel
Save