Open Closed

ASP.net Zero Angular Docker Deployment #7128


0
abrewer created

Hello, Im trying to deploy to docker for testing. I have deployed the host api project without issue. I am able to access the swagger page and read data from the DB. I am unable to get my angular site to appear via docker. I'm simply seeing the "Welcome to nginx!" message when I browse to localhost:9902.

When building for docker I am getting a few error messages, I will include this below.

FYI, I am using ASP.Net Zero v7. I have followed these instructions. https://aspnetboilerplate.com/Pages/Documents/Articles/Running-in-Docker-Containers-and-Building-a-Web-Farm-Load-Balancer-Scenario/index.html

PS C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build> .\build-with-ng.ps1
New-Item : An item with the specified name C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs already exists.
At C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\build-with-ng.ps1:13 char:1
+ New-Item -Path $outputFolder -ItemType Directory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (C:\Users\baaro\...e\build\outputs:String) [New-Item], IOException
    + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 81.1 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application.Shared\Orca.Application.Shared.csproj.
  Restore completed in 81.1 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core.Shared\Orca.Core.Shared.csproj.
  Restore completed in 92.32 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application\Orca.Application.csproj.
  Restore completed in 92.32 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core\Orca.Core.csproj.
  Restore completed in 33.86 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.EntityFrameworkCore\Orca.EntityFrameworkCore.csproj.
  Restore completed in 62.91 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.GraphQL\Orca.GraphQL.csproj.
  Restore completed in 64.49 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Core\Orca.Web.Core.csproj.
  Restore completed in 51.76 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Host\Orca.Web.Host.csproj.
  Orca.Core.Shared -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core.Shared\bin\Release\netstandard2.0\Orca.Core.Shared.dll
  Orca.Application.Shared -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application.Shared\bin\Release\netstandard2.0\Orca.Application.Shared.dll
  Orca.Core -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core\bin\Release\netcoreapp2.2\Orca.Core.dll
  Orca.GraphQL -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.GraphQL\bin\Release\netcoreapp2.2\Orca.GraphQL.dll
  Orca.EntityFrameworkCore -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.EntityFrameworkCore\bin\Release\netcoreapp2.2\Orca.EntityFrameworkCore.dll
  Orca.Application -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application\bin\Release\netcoreapp2.2\Orca.Application.dll
  Orca.Web.Core -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Core\bin\Release\netcoreapp2.2\Orca.Web.Core.dll
  Orca.Web.Host -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Host\bin\Release\netcoreapp2.2\Orca.Web.Host.dll
  Orca.Web.Host -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Host\bin\Release\netcoreapp2.2\Orca.Web.Host.Views.dll
  Orca.Web.Host -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs\Host\
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 72.77 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core.Shared\Orca.Core.Shared.csproj.
  Restore completed in 72.77 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application.Shared\Orca.Application.Shared.csproj.
  Restore completed in 78.43 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core\Orca.Core.csproj.
  Restore completed in 78.43 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application\Orca.Application.csproj.
  Restore completed in 36.77 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.EntityFrameworkCore\Orca.EntityFrameworkCore.csproj.
  Restore completed in 29.29 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.GraphQL\Orca.GraphQL.csproj.
  Restore completed in 34.87 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Core\Orca.Web.Core.csproj.
  Restore completed in 28.11 ms for C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Public\Orca.Web.Public.csproj.
  Orca.Core.Shared -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core.Shared\bin\Release\netstandard2.0\Orca.Core.Shared.dll
  Orca.Application.Shared -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application.Shared\bin\Release\netstandard2.0\Orca.Application.Shared.dll
  Orca.Core -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Core\bin\Release\netcoreapp2.2\Orca.Core.dll
  Orca.GraphQL -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.GraphQL\bin\Release\netcoreapp2.2\Orca.GraphQL.dll
  Orca.EntityFrameworkCore -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.EntityFrameworkCore\bin\Release\netcoreapp2.2\Orca.EntityFrameworkCore.dll
  Orca.Application -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Application\bin\Release\netcoreapp2.2\Orca.Application.dll
  Orca.Web.Core -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Core\bin\Release\netcoreapp2.2\Orca.Web.Core.dll
  Orca.Web.Public -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Public\bin\Release\netcoreapp2.2\Orca.Web.Public.dll
  Orca.Web.Public -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\src\Orca.Web.Public\bin\Release\netcoreapp2.2\Orca.Web.Public.Views.dll
  Orca.Web.Public -> C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs\Public\
yarn install v1.15.2
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.53s.

Date: 2019-06-06T22:06:59.849Z
Hash: 7cfce7a47d18beba2d99
Time: 126706ms
chunk {0} 0.a0227af43db19ff835de.js () 48.9 kB  [rendered]
[....]
chunk {1087} 1087.4ccacd4485cbbf1ef305.js () 8.76 kB  [rendered]
chunk {1088} 1088.51d0c78512d66d58d0f4.js () 2.18 kB  [rendered]
chunk {1089} 1089.1094f00453c954071e05.js () 2.41 kB  [rendered]
chunk {1090} 1090.14bffdc316cebc9be276.js () 1.24 kB  [rendered]
chunk {1091} 1091.e9b58e506172b869fbeb.js () 2.99 kB  [rendered]
chunk {1092} 1092.586627d106e8b872d67b.js () 1.54 kB  [rendered]
chunk {1093} 1093.3082dcd894fcb8515058.js () 2.19 kB  [rendered]
chunk {scripts} scripts.a5e0cae88fa522ad84d9.js (scripts) 1.65 MB [entry] [rendered]

WARNING in Invalid selector '> .swal2-input' at 8076:0. Ignoring.

WARNING in Invalid selector '> .swal2-file' at 8077:0. Ignoring.

WARNING in Invalid selector '> .swal2-textarea' at 8078:0. Ignoring.

WARNING in Invalid selector '> .swal2-select' at 8079:0. Ignoring.

WARNING in Invalid selector '> .swal2-radio' at 8080:0. Ignoring.

WARNING in Invalid selector '> .swal2-checkbox' at 8081:0. Ignoring.
Get-Content : Cannot find path 'C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs\ng\assets\appconfig.json'
because it does not exist.
At C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\build-with-ng.ps1:44 char:2
+ (Get-Content $ngConfigPath) -replace "22742", "9901" | Set-Content $n ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\baaro\...\appconfig.json:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Get-Content : Cannot find path 'C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs\ng\assets\appconfig.json'
because it does not exist.
At C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\build-with-ng.ps1:45 char:2
+ (Get-Content $ngConfigPath) -replace "4200", "9902" | Set-Content $ng ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\baaro\...\appconfig.json:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Untagged: zero/host:latest
Deleted: sha256:6c5f761af6f1d64dc3bbe471b8099ae3d8589c61bcd3d7dada84086e9273a94e
Deleted: sha256:2a599e21b89dc15ba02a96513887adbfab19e73fd5d342dc235a29440ee2642b
Deleted: sha256:006d1f222066b6ad03c7df57b751050813d9880bc7e9b7135a7c5e7014b6b084
Deleted: sha256:fbcbf3de19f1fd1b182b6f73c31be0e9392b1ed1f374a216d7989f2024f9ff6c
Deleted: sha256:153639a72136427330bc1b33592882783f3c255040fecde5b36a02ac5f642db0
Sending build context to Docker daemon  63.32MB
Step 1/4 : FROM microsoft/dotnet:2.2-aspnetcore-runtime
 ---> f6d51449c477
Step 2/4 : WORKDIR /app
 ---> Running in 420e5d489da8
Removing intermediate container 420e5d489da8
 ---> da1d23c112cc
Step 3/4 : COPY . .
 ---> 932046eda647
Step 4/4 : ENTRYPOINT ["dotnet", "Orca.Web.Host.dll"]
 ---> Running in f8fa870ad487
Removing intermediate container f8fa870ad487
 ---> 22cf70b6dcb4
Successfully built 22cf70b6dcb4
Successfully tagged zero/host:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Untagged: zero/public:latest
Deleted: sha256:6f5bb11a1913b3ebe6ddd76e190ca56a7ff9677c2c6180c49d0e9d13ee3e77b5
Deleted: sha256:d3591367167886837ef831d4a8c47b2512fea0f5fc6f1b3e82fe944f1c40a86c
Deleted: sha256:53e15651977ec223169a9ddd0b0d1bb91ec872f7fafd272fb77e41a543fe1ede
Deleted: sha256:7cc9d6ea977d7ddfa7e1b5a4d94f51a6a737abfa062439340b3db09b09f8a115
Deleted: sha256:3c0eb71189a48e1394702faf127682d0839f29fb9aaa3eed1d3f7b939386c258
Sending build context to Docker daemon  73.48MB
Step 1/4 : FROM microsoft/aspnetcore:2.0.4
 ---> f2b512892cf6
Step 2/4 : WORKDIR /app
 ---> Running in 1a27edf45d39
Removing intermediate container 1a27edf45d39
 ---> 3698b85d539c
Step 3/4 : COPY . .
 ---> 46398458d7c7
Step 4/4 : ENTRYPOINT ["dotnet", "Orca.Web.Public.dll"]
 ---> Running in 99d9f099795a
Removing intermediate container 99d9f099795a
 ---> 5feecc417040
Successfully built 5feecc417040
Successfully tagged zero/public:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Untagged: zero/ng:latest
Deleted: sha256:85405a731a2e004a3be775defcda333efeb562bc523c4523ff60b0cd978b3795
Deleted: sha256:fcf16c99c4222520e5dfa78b3ddc67102a22591b70cd82e12d28fb3237d8c333
Sending build context to Docker daemon  107.7MB
Step 1/2 : FROM nginx
 ---> 62c261073ecf
Step 2/2 : COPY . /usr/share/nginx/html
 ---> cd1f601a9330
Successfully built cd1f601a9330
Successfully tagged zero/ng:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

2 Answer(s)
  • 0
    ryancyq created

    Hi, seems like the appconfig is missing, can you see if the file exists after ng bulld -prod ?

    Get-Content : Cannot find path 'C:\Users\baaro\Desktop\Orca\Orca\aspnet-core\build\outputs\ng\assets\appconfig.json' because it does not exist.

  • 0
    abrewer created

    that was the issue. it works now. thank you!