❔ dotnet publish docker fails
This is my Dockerfile (It's in the root of the project)
Output:
# ---- Vue.js Build Stage ----
FROM node:16-alpine AS build-vue
WORKDIR /app
# Copy package.json and yarn.lock for yarn install
COPY BFF/clientapp/package.json BFF/clientapp/yarn.lock ./
RUN yarn install
# Copy the rest of the Vue.js app and build it
COPY BFF/clientapp/ .
RUN yarn build
# .NET stages
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY BFF/BackendForFrontend.csproj ./BFF/
COPY Workcruit.Recruiter.WebClient.Grains/Workcruit.Recruiter.WebClient.Grains.csproj ./Workcruit.Recruiter.WebClient.Grains/
RUN dotnet restore BFF/BackendForFrontend.csproj
COPY . .
WORKDIR "/src/BFF"
# Copy the built Vue.js files to the .NET project
COPY --from=build-vue /app/dist ./ClientApp/dist
RUN dotnet build "BackendForFrontend.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "BackendForFrontend.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BackendForFrontend.dll"]# ---- Vue.js Build Stage ----
FROM node:16-alpine AS build-vue
WORKDIR /app
# Copy package.json and yarn.lock for yarn install
COPY BFF/clientapp/package.json BFF/clientapp/yarn.lock ./
RUN yarn install
# Copy the rest of the Vue.js app and build it
COPY BFF/clientapp/ .
RUN yarn build
# .NET stages
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY BFF/BackendForFrontend.csproj ./BFF/
COPY Workcruit.Recruiter.WebClient.Grains/Workcruit.Recruiter.WebClient.Grains.csproj ./Workcruit.Recruiter.WebClient.Grains/
RUN dotnet restore BFF/BackendForFrontend.csproj
COPY . .
WORKDIR "/src/BFF"
# Copy the built Vue.js files to the .NET project
COPY --from=build-vue /app/dist ./ClientApp/dist
RUN dotnet build "BackendForFrontend.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "BackendForFrontend.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BackendForFrontend.dll"]Output:
