Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 3. Deploying applications with OpenShift Client

download PDF

You can use OpenShift Client (oc) for application deployment. You can deploy applications from source or from binary artifacts.

3.1. Deploying applications from source using oc

The following example demonstrates how to deploy the example-app application using oc, which is in the app folder on the dotnet-8.0 branch of the redhat-developer/s2i-dotnetcore-ex GitHub repository:

Procedure

  1. Create a new OpenShift project:

    $ oc new-project sample-project
  2. Add the ASP.NET Core application:

    $ oc new-app --name=example-app 'dotnet:8.0-ubi8~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnet-8.0' --build-env DOTNET_STARTUP_PROJECT=app
  3. Track the progress of the build:

    $ oc logs -f bc/example-app
  4. View the deployed application once the build is finished:

    $ oc logs -f dc/example-app

    The application is now accessible within the project.

  5. Optional: Make the project accessible externally:

    $ oc expose svc/example-app
  6. Obtain the shareable URL:

    $ oc get routes

3.2. Deploying applications from binary artifacts using oc

You can use .NET Source-to-Image (S2I) builder image to build applications using binary artifacts that you provide.

Prerequisites

  1. Published application.

    For more information, see

Procedure

  1. Create a new binary build:

    $ oc new-build --name=my-web-app dotnet:8.0-ubi8 --binary=true
  2. Start the build and specify the path to the binary artifacts on your local machine:

    $ oc start-build my-web-app --from-dir=bin/Release/net8.0/publish
  3. Create a new application:

    $ oc new-app my-web-app
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.