Skip to content

Building a docker container image, upload it to IBM Cloud Container Registry, and deploy an application on cloud using a serverless technology called IBM Code Engine!

Notifications You must be signed in to change notification settings

thanosdrome/Deploy-an-Application-on-Cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deploy-an-Application-on-Cloud

Building a docker container image, upload it to IBM Cloud Container Registry, and deploy an application on cloud using a serverless technology called IBM Code Engine!

Objectives:

Clone the source code Build Docker image Deploy on Docker Tag and Push image to IBM Cloud Deploy on IBM Code Engine

#Docker Containers are isolated environments that package applications and their dependencies. Each container runs as an isolated process on the host operating system.

Docker is an open-source platform that enables developers to automate the deployment and management of applications inside lightweight, isolated containers.

IBM Cloud

IBM Cloud is a cloud computing platform and suite of cloud-based services offered by IBM. It provides a range of infrastructure, platform, and software services to support the development, deployment, and management of various types of applications and workloads in the cloud.

IBM Code Engine

IBM Cloud Code Engine is a serverless compute platform provided by IBM Cloud. It allows developers to deploy and run containerized applications without the need to manage the underlying infrastructure. Abstracting away the complexities of server provisioning, scaling, and maintenance, enabling developers to focus on writing code and building applications.

#Step 1 Verify that docker CLI is installed. Of terminal and type

Command to Check:

  docker --version

#Step 2 Verify that ibmcloud CLI is installed.

Again in terminal

Command to Check:

ibmcloud version

Start Code Engine

#Step 3 On the menu select Code Engine. The code engine setup panel appears. Click Create Project to begin. image

#Step 4 The code engine environment takes a while to prepare. You will see the progress status is indicated in the setup panel. image

#Step 5 Once the code engine set up is complete, you can see that it is active. Click Code Engine CLI to begin the pre-configured CLI in the terminal as shown below. image

#Step 6 You will observe that the pre-configured CLI startup and the home directory are set to the current directory. As a part of the pre-configuration, the project has been set up, and Kubeconfig is set up. The details are shown on the terminal as follows. image

#Step 6

Set-up : Create application

Open a terminal window by using the menu in the editor: Terminal > New Terminal. image

At this point Enter Git Commands to clone your existing repo. or import your already developed application. After sucessfully Importing your application follow below steps

Task 1: Containerise the application

Let’/s start modernising our application. The first step towards it is to containerise it using Docker.

Create Dockerfile

tasks:

Paste the following content in "Open Dockerfile in IDE"

Use the below as Dockerfile content.

FROM nginx
COPY favicon.ico /usr/share/nginx/html/favicon.ico
  COPY index.html /usr/share/nginx/html/index.html
  COPY script.js /usr/share/nginx/html/script.js
  COPY style.css /usr/share/nginx/html/style.css
  COPY data.json /usr/share/nginx/html/data.json

And it should look like below:

image

Build an image from a Dockerfile

Following Code

docker build -t Your Project Name .

image

list Built Images

Following Code

docker images .

image

Run the image

Following Code

docker run -it -d -p 8080:80 Your App Name

image

Must Check for the port for server should be 8080 or what you've put, test lauch your app.

Task 2: Deploy on IBM Cloud

Let’s start with launching Code Engine CLI.

image

Push the image to IBM Cloud

Type

docker push us.icr.io/${SN_ICR_NAMESPACE}/Your-App-Name

image

Deploy the image on IBM CE

Type

ibmcloud ce application create --Your-App --image us.icr.io/${SN_ICR_NAMESPACE}/Your-App --registry-secret icr-secret --port 80

image

Take Cloud URL from the output; which looks something like: https://Your_app.somerandomalphanumeric.us-south.codeengine.appdomain.cloud and open in your browser.

Congratulations

You have completed the deployment and learned how to deploy and host a standard application in Docker and on IBM Cloud.

Author

Shudhanshu Ranjan

About

Building a docker container image, upload it to IBM Cloud Container Registry, and deploy an application on cloud using a serverless technology called IBM Code Engine!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published