{"id":50032,"date":"2025-07-10T11:04:11","date_gmt":"2025-07-10T11:04:11","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=50032"},"modified":"2025-07-12T05:56:28","modified_gmt":"2025-07-12T05:56:28","slug":"openshift-build-your-application-from-source-code","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/openshift-build-your-application-from-source-code\/","title":{"rendered":"Openshift: Lab 11 &#8211; Build your application from source code"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">In this lesson, you will:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set up your Developer Sandbox<\/li>\n\n\n\n<li>Set up a cluster<\/li>\n\n\n\n<li>Build the application from source code<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Get that cluster<\/h3>\n\n\n\n<p>Once you&#8217;ve secured your own cluster, select&nbsp;<strong>Start using your sandbox<\/strong>&nbsp;to begin your future (Figure 1).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/get_started_sandbox_lp_figure_i.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/get_started_sandbox_lp_figure_i.png?itok=hHdhxZGm\" alt=\"Select Start using your sandbox.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 1: Select Start using your sandbox.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">&nbsp;Build the application from source code<\/h3>\n\n\n\n<p>To build your application using source code from a GitHub repository (repo), start by switching to the&nbsp;<strong>Developer<\/strong>&nbsp;view in your OpenShift dashboard (Figure 2).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure2dashboarddevelopermode.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure2dashboarddevelopermode.png?itok=7SI5NtrY\" alt=\"The Developer view in your OpenShift dashboard.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 2: The Developer view in your OpenShift dashboard.<\/figcaption><\/figure>\n\n\n\n<p>Next, select&nbsp;<strong>+Add<\/strong>&nbsp;to display the many options available for adding an application to your cluster (Figure 3).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure3developer_add.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure3developer_add.png?itok=zIjvj3j1\" alt=\"Select\u00a0+Add to display the available options.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 3: Select&nbsp;+Add to display the available options.<\/figcaption><\/figure>\n\n\n\n<p>In our case, we are interested in the&nbsp;<strong>Git Repository\/Import from Git<\/strong>&nbsp;option. Select&nbsp;<strong>Import from Git<\/strong>&nbsp;(Figure 4).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure4import_from_git.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure4import_from_git.png?itok=lWyHnaTg\" alt=\"Selecting Import from Git will build an application from your source code.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 4: Selecting Import from Git will build an application from your source code.<\/figcaption><\/figure>\n\n\n\n<p>You will be prompted to enter a URL that points to a Git repo. This is where things get interesting. Red Hat OpenShift will copy the repo to an internal storage location, inspect it, and attempt to discern the import strategy to build it. OpenShift will choose one of the following methods to build the application:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Option 1<\/strong>: Using the Builder image\u00a0for the programming language used (i.e., the s2i option).<\/li>\n\n\n\n<li><strong>Option 2<\/strong>: Using the Dockerfile that is found in the Git repo.<\/li>\n\n\n\n<li><strong>Option 3<\/strong>: Using the DevFile that is found in the Git Repo.<\/li>\n<\/ul>\n\n\n\n<p>Again, we\u2019re focusing on Option 1 right now: Using the Builder image and the s2i technology. The Builder image is determined by inspecting the source code and may be .NET, JBoss, Perl, or one of several other options. Here are some URLs of sample code that you can use for their related languages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C# (.NET):\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/csharp_mvc.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/csharp_mvc.git<\/a><\/li>\n\n\n\n<li>Go:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-go.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-go.git<\/a><\/li>\n\n\n\n<li>Node.js:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-nodejs.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-nodejs.git<\/a><\/li>\n\n\n\n<li>PHP:\u00a0<a href=\"http:\/\/github.com\/redhat-developer-demos\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-php.git<\/a>\u00a0<\/li>\n\n\n\n<li>Python:\u00a0<a href=\"https:\/\/developers.redhat.com\/learning\/learn:openshift:get-started-your-developer-sandbox\/resource\/github.com\/redhat-developer-demos\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-python.git<\/a><\/li>\n\n\n\n<li>Ruby:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-ruby.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-ruby.git<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Test your application<\/h2>\n\n\n\n<p>Supply the URL and move to the bottom of the page to select the&nbsp;<strong>Resource<\/strong>&nbsp;type (Figure 5).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/get_started_sandbox_figure5.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/get_started_sandbox_figure5.png?itok=dOj_QKMm\" alt=\"Select the Resource type for advanced options.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 5: Select the Resource type for advanced options.<\/figcaption><\/figure>\n\n\n\n<p>Select&nbsp;<strong>Deployment<\/strong>&nbsp;as the&nbsp;<strong>Resource<\/strong>&nbsp;type. Select&nbsp;<strong>Create&nbsp;<\/strong>(Figure 6).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/get_started_sandbox_figure6.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/get_started_sandbox_figure6.png?itok=7sLH5EXw\" alt=\"Select Deployment as the Resource type.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 6: Select Deployment as the Resource type.<\/figcaption><\/figure>\n\n\n\n<p>After a few minutes, the ring on your application&#8217;s icon will switch from light blue to dark blue,&nbsp;which&nbsp;means it&#8217;s ready to go. Select the external link image to see your application in a browser (Figure 7).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure6openshift-app-up-and-running.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure6openshift-app-up-and-running.png?itok=BTlrOcfQ\" alt=\"Click to launch your app in a browser.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 7: Click to launch your app in a browser.<\/figcaption><\/figure>\n\n\n\n<p>Congratulations. You&#8217;ve built an application from source code. Now it&#8217;s time to build your application from a container image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson, you will: Get that cluster Once you&#8217;ve secured your own cluster, select&nbsp;Start using your sandbox&nbsp;to begin your future (Figure 1). &nbsp;Build the application from source code To&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5153],"tags":[],"class_list":["post-50032","post","type-post","status-publish","format-standard","hentry","category-openshift"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=50032"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50032\/revisions"}],"predecessor-version":[{"id":50070,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50032\/revisions\/50070"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=50032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=50032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=50032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}