NET Core "ng build" Docker error

Im having an issue when i try to build my docker file. I have 2 projects:

  1. NET Core API and Angular (ClientApp) in same project
  2. Class repository for database calls

My NET Core project runs ‘ng build --configuration production’ command in .csproj file. When building dockerfile it throws error “ng build --configuration production” exited with code 1.

Here is my dockerfile:

# 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.

# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS with-node
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash
RUN apt-get -y install nodejs
RUN npm install -g @angular/cli

# This stage is used to build the service project
FROM with-node  AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["RegistryAngular/RegistryAngular.csproj", "RegistryAngular/"]
COPY ["RegistryAngular.DataAccess/RegistryAngular.DataAccess.csproj", "RegistryAngular.DataAccess/"]
RUN dotnet restore "./RegistryAngular/RegistryAngular.csproj"
COPY . .
WORKDIR "/src/RegistryAngular"
RUN dotnet build "./RegistryAngular.csproj" -c $BUILD_CONFIGURATION -o /app/build 

# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./RegistryAngular.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RegistryAngular.dll"]

Here is the image of solution and projects/folders and files:

What can be the issue here? Im new to docker.Thanks in advance.

You could run an interactive container from the base image and run the commands one by one. Then you can investigate any error code more easily. Sicne the error code is returned by ng, it requires someone who knows what why that command could fail. Once is is solved, any Docker would find it easier to help.

In an interactive container you can recognize missing files much easier.