简体   繁体   中英

Asp.Net Core not seeing files added to project during docker build

I have an asp.net core application that has nothing inside of it's wwwroot folder at build time but during docker build I have a stage that compiles my Angular application and then in a later stage copies the compiled files into the wwwroot folder. When the application launches and I directory browse nothing is there. I can run code that reads the directory and sees the files so what am I doing wrong here?

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM node:10.15-alpine as webbuild
COPY ["ShareWeb/Angular", "ShareWeb/web"]
WORKDIR /ShareWeb/web
RUN npm install
RUN npm install -g @angular/cli
RUN npm install -g sass
RUN npm rebuild node-sass
RUN ng build --prod


FROM microsoft/dotnet:2.2-sdk AS hostbuild
WORKDIR /src
COPY ["ShareWeb/ShareWeb.csproj", "ShareWeb/"]
RUN dotnet restore "ShareWeb/ShareWeb.csproj"
COPY . .
WORKDIR "/src/ShareWeb"
COPY --from=webbuild ShareWeb/web/dist wwwroot/ # Copies my files in
RUN dotnet build "ShareWeb.csproj" -c Release -o /app


FROM hostbuild AS publish
RUN dotnet publish "ShareWeb.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
RUN rm -r Angular
ENTRYPOINT ["dotnet", "ShareWeb.dll"]

On this line:

COPY --from=webbuild ShareWeb/web/dist wwwroot/ # Copies my files

Try: /ShareWeb/web/dist as the path instead of ShareWeb/web/dist

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM