Require CLI instructions for deploying a sample app to IBM Code Engine

248 views Asked by At

Since the IBM Cloud Foundry Service is getting deprecated real soon, I am in need of migrating my existing apps from Cloud Foundry to IBM Code Engine. I am successful in creating a sample app by following the UI instructions provided in IBM docs using the Dockerfile provided in same page.

Now I have the requirement to automate the following task using the jenkins pipeline jobs.

  • Creating/deploying a new sample app in CE environment(dockerfile)
  • Update the deployed app on code changes(dockerfile)
  • Set up a job to include the environment variables during deployment

I would like to get the CLI command to build and push the sample app dockerfile first, which then followed by other requirements.Quick help on this really appreciated.

1

There are 1 answers

0
Matthias Diester On

First of all, make sure you have correctly setup your IBM Cloud CLI, i.e. the region and resource group match your expected settings.

ibmcloud target -r <region> -g <resource-group>

The CLI and Code Engine plugin will tell in case this is not setup.

Next, make sure you have a project. So either use one that you already have and create a new one.

ibmcloud ce project create --name f00b4r          # new one
ibmcloud ce project select --name <your-project>  # existing one

Similar to the cf apps command, you can list the apps you already have:

ibmcloud ce app list

To create an app, use the following command:

ibmcloud ce application create --name myapp --image icr.io/codeengine/hello

There is a tutorial in the docs that covers this topic.

Coming from Cloud Foundry, you might be more interested or familiar with pushing source code rather than building the image or using a pre-existing image. The command looks very similar:

ibmcloud ce app create --name myapp --build-source . --strategy buildpacks

Check the Cloud Foundry to Code Engine migration guide for more details.