Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Docker Deployment encounter errors while running build-with-ng.ps1 #11504


User avatar
0
kill_kinglion created

Question 1: I follow this documentation (Publishing to Docker Containers) but when I run the build-with-ng.ps1 it emits the following error logs. A newbie friendly explanation would be appreciated.

ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Ferrari\develop\core\iChangeCore\Core\core-erp-system\aspnet-core\build\build-with-ng.ps1:46 char:1
+ ng build --prod
+ ~~
    + CategoryInfo          : ObjectNotFound: (ng:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Join-Path : A positional parameter cannot be found that accepts argument 'nginx.conf'.
At D:\Ferrari\develop\core\iChangeCore\Core\core-erp-system\aspnet-core\build\build-with-ng.ps1:48 char:37
+ ... -ItemType directory -Path (Join-Path $outputFolder "ng" "nginx.conf")
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Join-Path], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

And this at the end of logs:

=> ERROR [2/2] COPY ./dist /usr/share/nginx/html                                                                                                                                                                                       0.0s
------
 > [2/2] COPY ./dist /usr/share/nginx/html:
------
failed to solve: failed to compute cache key: "/dist" not found: not found

FYI: I installed angular/cli global so the missing 'ng' command seems to be fixed but was it the right way ?

Question 2: What are all the docker-compose file I found in the project directory? Any explanation on what's inside /aspnet-core/docker folders ? Since I couldn't find any documentation explaining about this folders, I'm not sure if I missed something important to deploying with docker.


4 Answer(s)
  • User Avatar
    0
    kill_kinglion created

    All fixed for question 1.

    1. installing angular/cli -g to make ng command runnable seems to be the solution to missing ng.
    2. ng build --prod is not usable now. Changing to ng build --configuration production to make Angular build and ./dist now appear.
    3. The join path error was caused by this New-Item -ItemType directory -Path (Join-Path $outputFolder "ng" "nginx.conf") It seems that this line of command have 3 arguments of Join-Path but my powershell doesnt accept 3 arguments so I let ChatGPT redesign the command to make it usable in 2 arguments. But the key shenanigan is that command line tries to create a folder called nginx.conf which seems unreasonable since there is no point creating a folder called nginx.conf and there is also another command that will copy the actual file of nginx.conf and paste there anyway so I simply remove this line and the PowerShell starts working now.
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kill_kinglion

    Thanks, we will update the related files. Please follow https://github.com/aspnetzero/aspnet-zero-core/issues/4777

  • User Avatar
    0
    kill_kinglion created

    Hi @kill_kinglion

    Thanks, we will update the related files. Please follow https://github.com/aspnetzero/aspnet-zero-core/issues/4777

    Anyway, I couldnt see the github. My github account is "Atirudom".

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You have been invited on GitHub. You can see the link content after accepting the invitation.