s2i-dotnetcore
s2i-dotnetcore copied to clipboard
Dotnet core S2i build error ssl connects to wrong nuget
I am trying to build my solution and create docker image using OpenShift S2i pattern.
Using the below command to build the repository
oc new-app dotnet:3.1~http://azureserver.abc.com:8080/tfs/_git/Emp-WebServices --name employeewebservice
we are unable to connect to the Nuget Private repository internal to our network, in the logs it tries to connect to nuget.org to pull our private packages and not connecting to our Company's hosted Nuget config
/opt/app-root/src/Emp.WebServices/Emp.WebService...ler. No packages exist with this id in source(s): nuget.org
/opt/app-root/src/Emp.WebServices/Emp.WebService...ter. No packages exist with this id in source(s): nuget.org
/opt/app-root/src/Emp.WebServices/Emp.WebService...ter. No packages exist with this id in source(s): nuget.org
Restore failed in 2.14 min for /opt/app-root/src/Emp.WebServices/Emp.WebServices.csproj.
error: build error: error building at STEP "RUN /tmp/scripts/assemble": error while running runtime: exit status 1
Below is our environment file in s2i folder and its contents
ASPNETCORE_ENVIRONMENT=Production
DOTNET_STARTUP_PROJECT=Emp.WebServices/Emp.WebServices.csproj
DOTNET_RESTORE_CONFIGFILE=Nuget/NuGet.Config
DOTNET_CONFIGURATION=Release
HTTP_PROXY=http://proxy-web.avc.com:80
HTTPS_PROXY=http://proxy-web.avc.com:80
NO_PROXY=localhost,.avc.com
DOTNET_SSL_DIRS=certificates
Placed ca-bundle.crt in the certificates folder which is in the root of our project
Also below is our nuget config in the root folder nuget/nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="AvcNuGet" value="http://abcnugeto1.avc.com/nuget" />
<add key="nuget.org" value="https://api.nuget.org/v3/" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
</packageRestore>
</configuration>
Am I missing any thing, we are stuck with this since long and not able to find good resources on how to build this.
@phaniwithu
Out of curiosity, what happens if you explicitly specify the config file using the DOTNET_RESTORE_CONFIGFILE
environment variable?
we have specified explicitly only, below is the environment variables where we are specifying the DOTNET_RESTORE_CONFIGFILE
ASPNETCORE_ENVIRONMENT=Production
DOTNET_STARTUP_PROJECT=Emp.WebServices/Emp.WebServices.csproj
DOTNET_RESTORE_CONFIGFILE=Nuget/NuGet.Config
DOTNET_CONFIGURATION=Release
HTTP_PROXY=http://proxy-web.avc.com:80
HTTPS_PROXY=http://proxy-web.avc.com:80
NO_PROXY=localhost,.avc.com
DOTNET_SSL_DIRS=certificates
Same error as mentioned in the question
is there any other way to do this ?
@phaniwithu Hey, sorry for missing that from your original post. Let me see if I can reproduce the issue and see what is going on.
@aslicerh I was able to resolve this, place the nuget.config in the root folder where the .csproj file is there. Thanks for your comments
@aslicerh Also I noticed that even the subsequent builds take hours to complete, is there anyway to speed them up ?
@paoloantinori Do you see the same slowdown if you are using your proxy outside of a container, or only with the container? Looking at your logs, can you see what step is taking a long time? And in general, are you limiting the CPU for the containers, and if so, does your build time decrease if you give the containers more CPU quota?
hello! I suspect the previous message was supposed to tag someone else
@paoloantinori You are correct, I am so sorry about that. @phaniwithu Please see my previous comment.
@paoloantinori Increasing the CPU fixed the issue of build taking too much time
@paoloantinori Increasing the CPU fixed the issue of build taking too much time
🙃
It seems the issue is fixed. Closing.