Giter Club home page Giter Club logo

s2i-dotnetcore's Introduction

.NET S2I Container Images

This repository contains the sources for building .NET SDK and runtime container images.

The images support OpenShift source-to-image.

Supported Versions

Version OS Documentation
6.0 UBI 8, Fedora SDK image
Runtime image
8.0 UBI 8 SDK image
Runtime image

EOL Versions

Version OS Documentation
1.0 RHEL 7, CentOS 7 SDK image
Runtime image
1.1 RHEL 7 SDK image
Runtime image
2.0 RHEL 7, CentOS 7 SDK image
Runtime image
2.1 RHEL 7, UBI 8,
CentOS 7
SDK image
Runtime image
2.2 RHEL 7, CentOS 7 SDK image
Runtime image
3.0 RHEL 7, UBI 8 SDK image
Runtime image
3.1 RHEL 7, UBI 8,
CentOS 7, Fedora
SDK image
Runtime image
5.0 UBI 8, CentOS 7,
Fedora
SDK image
Runtime image
7.0 UBI 8, Fedora SDK image
Runtime image

Building

You can build (and test) the images by executing the build.sh script and pass it the versions to build.

$ git clone https://github.com/redhat-developer/s2i-dotnetcore.git
$ ./build.sh --ci 6.0 8.0

To override the default basis of the image, you can use the --base-os argument. For example: --base-os fedora or --base-os rhel8.

For an overview of all build script arguments, run: ./build.sh --help.

Installing

The image streams can be added to OpenShift by importing an dotnet_imagestreams_*.json file with the OpenShift client oc.

oc apply -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/main/dotnet_imagestreams.json

The dotnet_imagestreams_*.json files define the supported .NET versions for a specific architecture:

Architecture File
x64 https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/main/dotnet_imagestreams.json
arm64 https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/main/dotnet_imagestreams_aarch64.json
ppc64le https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/main/dotnet_imagestreams_ppc64le.json
s390x https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/main/dotnet_imagestreams_s390x.json

s2i-dotnetcore's People

Contributors

alberttwong avatar asaf400 avatar aslicerh avatar bparees avatar dependabot[bot] avatar dnguyen9 avatar gabemontero avatar indor79 avatar jerboaa avatar jnordell avatar lrgar avatar luciddreamz avatar mkeuschn avatar omajid avatar paulrobinson avatar tanaka-takayoshi avatar tlbdk avatar tmds avatar yselkowitz avatar yudhiwidyatama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s2i-dotnetcore's Issues

The latest template in master branch does not work

I am trying to run the dotnet-runtime-example-runtime on top of Minishift using the dotnet add-on which downloads the templates and image streams from here. It seems the templates are not working as expected and giving me following error.

An error occurred while starting the build.
Reason: Error resolving ImageStreamTag dotnet:2.0 in namespace openshift: unable to find latest tagged image

[1] https://github.com/minishift/minishift-addons/tree/master/add-ons/dotnet

Automate imagestream testing

Our tests are docker and image centric.
It would be nice to also automate testing of imagestreams/templates.
Perhaps we can use minishift to facilitate running these tests locally.

CC @RheaAyase @aslicerh

Tags

There are no tags in this repository which match the released docker image tags. Can we add these?

For the 10 image, there are tags: 1.0-2, 1.0-8, 1.0-10, 1.0-12. What is the suffix used here?

support debugging

The current s2i dotnetcore docker image is available for remote debugging.But it requires a little bit complicated steps. I summarized the steps for remote debugging from Visual Studio code.
https://github.com/tanaka-takayoshi/s2i-dotnetcore/wiki/Remote-Debugging-s2i-dotnetcore-from-Visual-Studio-Code

Do you have a plan for making it easier?

  • pre-installed vsdbg in docker image
  • pre-installed unzip in docker image (vsdbg is not installed by default, but make it easy to install vsdbg)

dotnet 2 solutions with more than 1 project?

I am not a real dotnet person but doing a little with it with s2i so I may be missing something regarding building dotnet 2.0 solutions (using the Visual Studio vernacular) that have more than one project in them.
From looking at assemble there is a find looking for proj files but set to a maxdepth of 1 at

PROJFILES=(`find "${DOTNET_STARTUP_PROJECT}" -maxdepth 1 -name "*.??proj"`)

I think it then works like this:

  • 1 project found, continues as normal
  • 0 projects found, error
  • more than 1 project found, it suggests selecting 1 in a .s2i/environment file to specify one of them

The tests all appear to be using single projects.

My question is should assemble support solutions that contain multiple projects (which I think is the normal dotnet architecture)?
If so, are there examples of how to do this?

Again, I may be completely off base and missing something entirely but the s2i related documentation does not appear to address this.

Support runtime image with store

As part of the assemble for 2.0 we currently override all stores by specifying /p:TargetManifestFiles=.

We should support the case where a user wants to create its own runtime image that includes a store. This may be the ASP.NET Core runtime store. It can also be a custom store (which can be meaningful in large deployments).

Instead of setting TargetManifestFiles, we can add a new property DOTNET_ASPNET_STORE that defaults to false and is passed to the publish command to set the PublishWithAspNetCoreTargetManifest property.

CC @omajid @jerboaa @aslicerh

Build failed when Creating dotnet 1.0 and 1.1 build

when creating build with
$oc new-build https://github.com/redhat-developer/s2i-dotnetcore --context-
dir=1.0/test/asp-net-hello-world/ ,it displays as "error: DOTNET_STARTUP_PROJECT has no project file
You can specify the startup project by adding an '.s2i/environment' file to the source repository.
The source repository has no project files.
error: build error: non-zero (13) exit code from registry....dca780475373a34be07877b152f94ff7ef4168758f1f9011bc71793245f"
I am not sure if the repo can be used now? hope your feedback

Pre-release versions of .Net core?

Hi there, I have a question regarding nightly builds of Core SDK.

Is it possible to get your images with core 2.1-preview SDK's?
Or maybe I could use somehow microsoft/dotnet-nightly:2.1 stream?

[Proposal] DEV_MODE: support publishing

As enhancement, it may be interesting for the user to be able to publish instead of run the application.

Note that the current behavior (run) is similar to the VS IDE user experience.
publish is intended for packing the application and involves steps that make it slower than run.
The normal s2i build in OpenShift publishes the application.

CC @mickaelistria

Add dotnet template

Similar to https://github.com/redhat-developer/s2i-dotnetcore-ex/blob/master/templates/aspnet-s2i-template.json, but different...

  • rename aspnet to dotnet

aspnet refers to the open source microsoft webstack. There are other popular webstacks like nancy (http://nancyfx.org/). s2i-dotnetcore is not 'aspnet' specific.

  • add parameters for all s2i-dotnetcore environment variables

The names of these parameters match the environment names exactly.

  • Store the template in this repo

The template is versioned with the rest of the s2i-dotnetcore repo.

@jerboaa @omajid what's do you think?

runtime image does not have an entrypoint

To use the runtime image, you can do this:

FROM registry.access.redhat.com/dotnet20-runtime-rhel7

ADD bin/Release/netcoreapp2.0/rhel.7-x64/publish/. .

CMD ["scl", "enable", "rh-dotnet20", "--", "dotnet", "couchbase_demo.dll"]

It would be nicer without the scl enable.
We can probably handle this via an ENTRYPOINT.
This should also call generate_container_user.

The entrypoint could also check for the s2i_run script and invoke that when there are no arguments. Then the user doesn't need to handle this for a s2i build into a runtime image.

Support building top level .sln files

I received a few requests from customers about wanting to use our s2i images with .sln (solution) files. I cant tell if it those are supported for s2i or not. We should document it if it is already implemented or implement it if it missing.

I believe their use case looks like this:

Main.sln
├── Project1
│   ├── Project1.csproj
│   └── Program.cs
└── Library
    ├── Class1.cs
    └── Library.csproj

It would be great if we could automatically see the .sln file and run
an appropriate dotnet build Main.sln instead of failing because no
.csproj file exists in the directory root.

Use of dotnet:latest tag

I wonder if we should remove the dotnet:latest from our image streams.

  1. Latest can break builds.
    E.g. when latest moved from 1.0 to 1.1, all 1.0 using latest would break.
    Versioning rules have been changed for .NET Core 2.
    Now when latest moves from 2.x to 3.x things will break.

  2. Asides from us breaking the apps by moving latest, users need to use a version that is compatible with their .NET Core application. This isn't necessarily latest. So they know explicitly what version they'd like.

(Note there is a use-case for 'latest 2x' as this allows users to stay on a supported compatible version. We can consider that when we do 2.1.)

Feel free to give some feedback. If you are fine with removing latest, a thumbs up on the issue is enough.

CC @omajid @jerboaa @aslicerh @bparees

Dotnet runtime image has default root user

Steps to reproduce:

sudo docker run -ti --rm --entrypoint=/bin/bash dotnet/dotnet-20-rhel7-runtime -c 'whoami'
root

Should be: default

The builder image is fine:

sudo docker run -ti --rm --entrypoint=/bin/bash dotnet/dotnet-20-rhel7 -c 'whoami'
default

We are likely missing a: User 1001

Support passing source control info to dotnet build

There is a design proposal for passing source control info to dotnet build via environment variables: dotnet/designs#19

This issue tracks adding support for those environment variables to s2i-dotnetcore.

With the current proposal we can map as follows (from dotnet/designs#19 (comment)).

REPOSITORYCOMMITID = OPENSHIFT_BUILD_COMMIT
REPOSITORYNAME = N/A
REPOSITORYROOT = /opt/app-root/src
REPOSITORYURI = OPENSHIFT_BUILD_SOURCE

The s2i context-dir isn't available as an envvar. So if that is set, the source mapping in the repo is wrong. A user should set DOTNET_STARTUP_PROJECT instead.

CC @omajid @jerboaa @aslicerh

Support including --no-restore in assemble dotnet publish command

The --no-restore argument in assemble dotnet publish can be helpful for more granular control of the publishing function. An example of this is a build on a disconnected network where the build host cannot reach a nuget server and all necessary nuget packages are either already on the build host or contained in the build image.

Tracker bug for adding Msbuild support

Track info and activities on changes needed for change from project.json to msbuild/csproj.

Tasks:

  • detect default assembly name - project.json defaults to the <parentfolder>.dll. <name>.csproj defaults to <name>.dll
  • restore handling - dotnet restore will no longer work recursively, but it will work transitive on the referenced projects. We can deprecate DOTNET_RESTORE_ROOT and restore DOTNET_STARTUP_PROJECT and DOTNET_TEST_PROJECTS.

/cc @omajid @jerboaa

DOTNET_CONFIGURATION

Readme states:

DOTNET_CONFIGURATION

Used to run the application in Debug or Release mode. This should be either Release or Debug. This is passed to the dotnet publish invocation. Defaults to Release.

Why it is suggesting that only possible values are Release and Debug?
I think you should update this to reflect, that custom configurations also can be passed.

Possible correction:

Used to build/run the application in specified configuration mode (i.e. Debug, Release). This is passed to the dotnet publish and dotnet run invocation as -c paremeter. Defaults to Release.

DOTNET_FRAMEWORK should not be configurable by users.

While we should pass the explicit framework to build the app for, we shouldn't allow for users to configure it themselves. It doesn't make sense in the s2i context. Take for example the MusicStore app. It targets net451 and netcoreapp1.1[1]. It will only build successfully, with the .NET Core 1.1 image, when netcoreapp1.1 is explicitly passed to the dotnet build command.

For the 1.0 .NET Core builder image it should build for, well, .NET Core 1.0 and similarly, for the 1.1 .NET Core builder image it should be using .NET Core 1.1.

[1] https://github.com/aspnet/MusicStore/blob/dev/samples/MusicStore/project.json#L57

$PWD and $HOME should be different

For s2i container builds the current working directory coincides with $HOME of the container user (default). This is a problem because dotnet build recursively looks for source code files. If the app we are currently building pulls in nuget packages which contain source code files, dotnet build will try to compile them which might fail.

We need to make $HOME outside $PWD so as to not fall into the trap of trying to compile sources in downloaded nuget packages.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1408146

PR#42 broke sample app for released images

sudo docker run --user=100001 -it -p 8080:8080 registry.access.redhat.com/dotnet/dotnetcore-10-rhel7-testapp
---> Running application ...

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'SampleApp, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.FindStartupType(String startupAssemblyName, String environmentName)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildHostingServices()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.<>c__DisplayClass13_1.<BuildHostingServices>b__1(IServiceProvider _)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureStartup()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at SampleApp.Startup.Main(String[] args)
/usr/libexec/s2i/run: line 21:    18 Aborted                 (core dumped) dotnet "${APP_DLL_PATH}"

We need to use a different app for expecting a specific assembly name.

Support setting dotnet publish verbosity level

For determining what is happening during the dotnet publish operation in assemble it would be helpful to be able to pass in a environment variable for setting verbosity level (the publish -v argument).

Double restore issue with OS origin v1.5.0-alpha2

Hello,

When running the dotnetcore1.1 image on the latest origin docker image:

OpenShift Master:
v1.5.0-alpha.2+708ea98-310
Kubernetes Master:
v1.5.2+43a9be4

and trying to build the sample application packages seem to get restored twice:

Cloning "https://github.com/redhat-developer/s2i-dotnetcore-ex.git" ...
	Commit:	e3e6e5f848b97b148049fe1c6c2a4f7362091821 (Add .NET Core 1.1 support (#21))
	Author:	Severin Gehwolf <[email protected]>
	Date:	Tue Jan 31 10:27:14 2017 +0100
---> Copying application source ...
---> Installing dependencies ...
log  : Restoring packages for /opt/app-root/src/project.json...
log  : Restoring packages for /opt/app-root/src/app/project.json...
log  : Installing Microsoft.VisualStudio.Web.CodeGeneration.Utils 1.0.0-preview2-final.
...

This results in a lot of compiler errors for double declarations as so:

...
/opt/app-root/src/app/Controllers/ManageController.cs(68,42): error CS0111: Type 'ManageController' already defines a member called 'RemoveLogin' with the same parameter types
/opt/app-root/src/app/Controllers/ManageController.cs(86,30): error CS0111: Type 'ManageController' already defines a member called 'AddPhoneNumber' with the same parameter types
/opt/app-root/src/app/Controllers/ManageController.cs(95,42): error CS0111: Type 'ManageController' already defines a member called 'AddPhoneNumber' with the same parameter types
/opt/app-root/src/app/Controllers/ManageController.cs(112,42): error CS0111: Type 'ManageController' already defines a member called 'EnableTwoFactorAuthentication' with the same parameter types
/opt/app-root/src/app/Controllers/ManageController.cs(128,42): error CS0111: Type 'ManageController' already defines a member called 'DisableTwoFactorAuthentication' with the same parameter types
/opt/app-root/src/app/Controllers/ManageController.cs(143,42): error CS0111: Type 'ManageController' already defines a member called 'VerifyPhoneNumber' with the same parameter types
...

When running on the latest stable version of Origin (v1.4.1) everything is fine, so this is a regression.

I've also tried another application which works on v1.4.1, thinking it's a project.json issue, but got the same results.

Host is virtualized Fedora 25 Server in both test cases, running openshift on a single node (oc cluster up). The issue may be that my oc client tools are v1.3.1 but I am unsure how this affects the restoration process.

Nemanja

Split build documentation

  • We are missing documentation on how to configure OpenShift to do a split build.
  • For 2.0 we have a 2 README files (one under build, and one under runtime). Can we have a single README?

@aslicerh can you take care of this?

[Enhancement] Allow custom CA's to be provided via a config map

Custom CA's should be provided via a configuration map so that the .net application can use them at build time or during the application's runtime, as the CA's would be built into the image.

If I am not mistaken, we could simply put update-ca-trust extract at this line in the assemble script or at this line as part of the run script (not the ca's could not be used a build time then) and any config map that provides custom CA's to /etc/pki/ca-trust/source/anchors/ would be available to the container at startup.

Following: https://access.redhat.com/solutions/1519813

Control publish vs run

Since the previous release, the builder will do a dotnet publish and invoke the application directly instead of build+run. This requires the publishOptions to be setup correctly.

We should avoid breaking applications that do not have their publishOptions setup correctly.

In case our next release is a 'breaking' one (msbuild) we should handle this as part of the documentation.

If the next release is still based on project.json, we should default to the old behavior and make this controllable via an envvar (e.g. DOTNET_PUBLISH=y). In the succeeding msbuild release, we can drop this flag.

image dotnet/dotnet-20-rhel7:latest not found

./s2i build git://github.com/redhat-developer/s2i-dotnetcore --context-dir=2.0/test/asp-net-hello-world dotnet/dotnet-20-rhel7 dotnet-sample-app

pulling image error : Error: image dotnet/dotnet-20-rhel7:latest not found
ERROR: An error occurred: unable to get dotnet/dotnet-20-rhel7:latest
ERROR: Suggested solution: check image name, or if using local image add --pull-policy=never flag
ERROR: If the problem persists consult the docs at https://github.com/openshift/source-to-image/tree/master/docs. Eventually reach us on freenode #openshift or file an issue at https://github.com/openshift/source-to-image/issues providing us with a log from your build using --loglevel=3

Define the profile to use

Hi I have seen that I can pass some Environment variable in the buildconfig (example DOTNET_STARTUP_PROJECT). So I'm looking for a possibility to add the '--launch-profile' that I use lockally in visual studio code or visual studio to define the environment where I run it. Is there a possibility? (I think more correct is to set this in the deploy config)

dotnet repos with multiple projects at deeper than maxdepth 1

PROJFILES=(`find "${DOTNET_STARTUP_PROJECT}" -maxdepth 1 -name "*.??proj"`)

assemble is limited to dotnet projects at -maxdepth 1 from the clone.
In source repos where there are multiple projects at greater than 1 assemble does not pick them up and results in a find: 'xxx': No such file or directory error.

Not sure how common this is but it happened to me and I wanted to pass it along.

dotnet process not PID 1 when run

When I run an s2i built image in Docker dotnet is not the process with PID 1. I'm seeing:

$ ps ax                                    
  PID TTY      STAT   TIME COMMAND                                     
    1 ?        SLsl   0:55 dotnet run                   
   78 ?        SLl    0:09 /opt/rh/rh-dotnetcore10/root/usr/lib64/dotnetcore/dotnet exec --additionalprobingpath /opt/app-root/src/.nuget/packages /opt/app-root/src/bin/Debug/netcoreapp1.0/src.dll

or

$ ps ax                                             
  PID TTY      STAT   TIME COMMAND    
    1 ?        Ss     0:00 /bin/bash /usr/libexec/s2i/run         
   18 ?        SLl    0:02 dotnet ./bin/Release/netcoreapp1.0/src.dll

See redhat-developer/s2i-dotnetcore-ex@9bf016b. We should use exec.

Add rsync to dotnet/dotnet-20-rhel7

In order to better support the oc rsync command (which happens to be faster than alternatives commands to push a snapshot to running pod), it would be good to include in the image the rsync executable, or to inherit from an image that already has rsync.

Facilitate global tool installation

Microsoft will include a number of tools with it's SDK package which are at this point unfortunately not source-buildable 😕

We could do something similar to DOTNET_NPM_TOOLS to facilitate installing these (and possibly more) global tools as part of the build.

I think it is fine to not install any tools by default, since that installation step takes time and the tools are not a used for a typical application build&deploy scenario.

CC @omajid @aslicerh

Nuget returns SSL error

Hello there. I am running into a "Peer certificate cannot be authenticated with given CA certificates " when attempting to restore NUGET packages that are hosted on internal NUGET repo. The cert on the internal NUGET store is a local certificate and is trusted on my mac. But, I still get the "Peer certificate cannot be authenticated with given CA certificates " error. How could I overcome this issue?

The command that I am using is:

s2i build . registry.access.redhat.com/dotnet/dotnet-20-rhel7 web-app -e "DOTNET_STARTUP_PROJECT=MyApp.Api/MyApp.Api.csproj" -e "DOTNET_RESTORE_SOURCES=https://api.nuget.org/v3/index.json https://github.devops.local/repositories/"

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.