s2i-dotnetcore icon indicating copy to clipboard operation
s2i-dotnetcore copied to clipboard

Using the builder and runtime images with s2i build

Open rprakashg-redhat opened this issue 2 years ago • 2 comments

I'm trying to use the builder and runtime images with s2i build and is running into an issue starting the application in runtime image because i think the binary generated by the builder is not a publish version. When I run this command below

dotnet publish -c Release /p:MicrosoftNETPlatformLibrary=Microsoft.NETCore.App

and build a container image with s2i build with the binary generated from running above command and using the runtime image no issues. When i run s2i build with source and the builder image and specify run time image and runtime artifacts. s2i builds the final image with the runtime image and the binary inside it but the application doesn't start as it expects .net SDK

So my question is is there a way to generate a publish version when using the builder image in s2i build?

rprakashg-redhat avatar Aug 09 '22 14:08 rprakashg-redhat

@rprakashg-redhat The assemble script of the builder image should do a publish. You can see that here: https://github.com/redhat-developer/s2i-dotnetcore/blob/master/3.1/build/s2i/bin/assemble#L223

Do you have access to any logs from the building of the build container where the artifacts are supposed to be generated? Can you see any artifacts in the runtime image?

aslicerh avatar Aug 10 '22 22:08 aslicerh

dotnet publish -c Release /p:MicrosoftNETPlatformLibrary=Microsoft.NETCore.App

fyi, there is no need to set MicrosoftNETPlatformLibrary=Microsoft.NETCore.App. This was needed with .NET Core 2.x because our runtime image didn't include ASP.NET Core.

All currently supported .NET versions (.NET Core 3.1 and .NET 6.0) include ASP.NET Core in the runtime image.

but the application doesn't start as it expects .net SDK

How are you starting the application?

It should look like dotnet <someassembly.dll>. Commands like dotnet run are meant for starting applications during development and need the SDK.

tmds avatar Sep 06 '22 14:09 tmds

Closing due to inactivity.

tmds avatar Dec 12 '22 12:12 tmds