C
C#8mo ago
julian

❔ Docker: Dotnet restore just loading

This is my Dockerfile. It's installing all the node_modules and build is doing fine, but on dotnet restore, it's just loading. Why?
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

# ---- 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 appropriate directory in the .NET project
COPY --from=build-vue /app/dist ./wwwroot

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"]
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

# ---- 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 appropriate directory in the .NET project
COPY --from=build-vue /app/dist ./wwwroot

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"]
18 Replies
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
Nothing is being logged on dotnet restore.. It's just loading and loading. Like nothing happens
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
I tried --progess=plain yesterday, still nothing on dotnet restore "loading" or "hanging"
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
So, this line RUN dotnet restore "BFF/BackendForFrontend.csproj" in the Dockerfile, should be changed to dotnet restore -v:d "BFF/BackendForFrontend.csproj"?
MODiX
MODiX8mo ago
TeBeCo
dotnet restore -v:d
Quoted by
React with ❌ to remove this embed.
julian
julian8mo ago
So, only dotnet restore -v:d
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
Okey, I'll update you in a bit
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
@TeBeClone
No description
julian
julian8mo ago
It's just like this
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
julian
julian8mo ago
RUN dotnet restore -v:d "/BackendForFrontend.csproj". I tried running just RUN dotnet restore -v:d "BackendForFrontend.csproj", but that didn't work
MODiX
MODiX8mo ago
TeBeCo
you could docker run / attach / run the restore from the console to check what's going on
Quoted by
React with ❌ to remove this embed.
Pascal
Pascal8mo ago
I don't think / is normal here, your project is definitely not in the root folder of the container. Your project files are instead copied to /src, so it does not make sense to tell dotnet restore to restore a project at /BackendForFrontend.csproj when it is not there. You can do RUN ls in your container before the dotnet restore to see the file structure inside your container.
Accord
Accord8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.