Chapter 2. Install .NET Core 1.0 on Red Hat OpenShift Container Platform
Images are available for using .NET Core 1.0 on OpenShift Container Platform. See OpenShift Container Platform 3.3 Image Creation Guide for more details.
The .NET Core 1.0 software collection (rh-dotnetcore10) ships with the project.json build system (1.0.0-preview2 SDK). See the Known Issues in the .NET Core 1.0 Release Notes for details on installing this SDK on a non-RHEL system. Visual Studio 2017 dropped support for the project.json build system. Support for the msbuild/csproj build system will be added in the .NET Core 2.0 release.
2.1. Images Copy linkLink copied to clipboard!
Image stream definitions for the .NET Core on Red Hat Enterprise Linux Source to Image (S2I) are now added during OpenShift Container Platform installations. The Red Hat Enterprise Linux 7 images are available through Red Hat’s subscription registry using the following command.
docker pull registry.access.redhat.com/dotnet/dotnetcore-10-rhel7
$ docker pull registry.access.redhat.com/dotnet/dotnetcore-10-rhel7
To use this image, you can either access it directly from image registries or push them into your OpenShift Container Platform Docker registry. You can also create an image stream that points to the image, either in your Docker registry or at the external location. Your OpenShift Container Platform resources can then reference the image stream definition. See OpenShift Container Platform 3.4 Guide to Using Images for more information about using images.
See OpenShift Container Platform 3.3 Installation and Configuration for more information about Red Hat OpenShift Container Platform 3.3 and .NET Core.
2.2. Configuration Copy linkLink copied to clipboard!
The .NET Core images support a number of environment variables to control the build behavior of your .NET Core application.
You must set environment variables that control build behavior in the s2i build configuration or in the .s2i/environment file to make them available to the build steps.
| Variable Name | Description | Default |
|---|---|---|
| DOTNET_STARTUP_PROJECT |
Used to select the project to run. This must be the folder containing | Current working directory |
| DOTNET_PUBLISH |
Used to control whether the application should be built by executing | For backwards compatibility, the default is false. In the next major release, this variable will be removed and the builder will always publish the application. |
| DOTNET_ASSEMBLY_NAME |
Used to select the assembly to run. This must not include the
* The assembly to be |
The name of the |
| DOTNET_RESTORE_SOURCES |
Used to specify the space-separated list of NuGet package sources used during the restore operation. This overrides all of the sources specified in the | Unset |
| DOTNET_NPM_TOOLS | Used to specify a list of NPM packages to install before building the application | Unset |
| DOTNET_TEST_PROJECTS |
Used to specify the space-separated list of test projects to run. This must be folders containing | Unset |
| DOTNET_CONFIGURATION | Used to run the application in Debug or Release mode. This value should be either Release or Debug. | Release |
| ASPNETCORE_URLS |
This variable is set to | |
| HTTP_PROXY | Configures the HTTP proxy used when building and running the application | |
| HTTPS_PROXY | Configures the HTTPS proxy used when building and running the application | |
| NPM_MIRROR | Use a custom NPM registry mirror to download packages during the build process. |
Typical modern web applications rely on javascript tools to build the front end. The image includes npm (node package manager) to install these tools. Packages can be installed by setting DOTNET_NPM_TOOLS and by calling npm install in the build process.
2.3. Quickly Deploy Applications from .NET Core Source Copy linkLink copied to clipboard!
An image can be used to build an application by running oc new-app against a sample repository.
oc new-app registry.access.redhat.com/dotnet/dotnetcore-10-rhel7~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnetcore-1.0 --context-dir=app
$ oc new-app registry.access.redhat.com/dotnet/dotnetcore-10-rhel7~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnetcore-1.0 --context-dir=app