「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
「まずは手順に従って、imagestreamを設定するのですが、
最初は検証用のプロジェクトを作ってそのプロジェクトに
imagestreamを作ってみましょう。」
とあって、「imagestream」なんて「ファースト・ステップ」で
出てきてないので、潔く「Red Hat Customer Portal」を読もうと思いました。
>oc describe is dotnet --namespace openshift
希望のバージョンがない場合、Image Streamsを追加できる。
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json
権限があれば、Image Streamsをグローバルに追加できる。
>oc create --namespace openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json
github.comのredhat-developer/s2i-dotnetcore-exの
dotnetcore-2.0ブランチのaspnetcore2アプリをappフォルダにデプロイする。
(dotnet:2.0で)読み込んだImage Streamsと紐付け?
>oc new-app --name=exampleapp 'dotnet:2.0~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnetcore-2.0' --build-env DOTNET_STARTUP_PROJECT=app
>oc logs -f bc/exampleapp
>oc expose svc/exampleapp >oc get routes
できる。
# | 名前 | 説明 | 既定値 |
1 | DOTNET_STARTUP_PROJECT | プロジェクト・ファイルを含むフォルダ | |
2 | DOTNET_ASSEMBLY_NAME | アセンブリ名(.dll拡張子を含めない) | プロジェクト・ファイル名 |
3 | DOTNET_RESTORE_SOURCES | NuGet?パッケージソースのスペース区切りリスト。NuGet?.configを上書き。 | Unset |
4 | DOTNET_NPM_TOOLS | NPMパッケージのリスト | Unset |
5 | DOTNET_TEST_PROJECTS | テストプロジェクトのフォルダのリスト | Unset |
6 | DOTNET_CONFIGURATION | デバッグモード(Release)/リリースモード(Debug) | Release |
7 | ASPNETCORE_URLS | 公開ポート(OpenShiftに於いて変更は非推奨) | http://*:8080 |
3つのサンプルアプリケーションが利用可能
# | 名前 | 説明 |
1 | dotnet-example | デフォルトのMVCアプリケーション |
2 | dotnet-runtime-example | ランタイム・イメージとビルド・チェーンを使用して MVCアプリをビルドする方法を示す。 |
3 | dotnet-pgsql-persistent | Music Storeサンプルアプリケーション |
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-example.json
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-runtime-example.json
> oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-pgsql-persistent.json
>oc create -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-example.json >oc replace -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-example.json
>oc create -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-runtime-example.json >oc replace -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-runtime-example.json
>oc create -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-pgsql-persistent.json >oc replace -n openshift -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-pgsql-persistent.json
Build Configurationを定義する。
トリガを使用すると、イメージやコードが更新されたときに、
チェーン内のオブジェクトが必要に応じて再構築される。
>oc login https://opnshdnsxx.centralus.cloudapp.azure.com --token=XXXXX
>oc oc new-project pj11
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json
>oc new-app --name=exampleapp 'dotnet:2.0~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnetcore-2.0' --build-env DOTNET_STARTUP_PROJECT=app
>oc logs -f bc/exampleapp
>oc expose svc/exampleapp >oc get routes
>oc oc new-project pj11
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-example.json
>oc new-app dotnet-example --name=exampleapp
>oc logs -f bc/exampleapp
>oc expose svc/exampleapp >oc get routes
>oc oc new-project pj2
>oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-runtime-example.json
>oc new-app dotnet-runtime-example --name=runtimeexampleapp
>oc logs -f bc/runtimeexampleapp
>oc expose svc/runtimeexampleapp >oc get routes
>oc oc new-project pj2
> oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/templates/dotnet-pgsql-persistent.json
>oc new-app dotnet-pgsql-persistent --name=persistentapp
>oc logs -f bc/persistentapp
>oc expose svc/persistentapp >oc get routes