This application is an example used to test deploying to IBM Cloud Code Engine using the following two GitHub Actions:
Create, Update and Delete to IBM Cloud Code Engine
In order to follow the steps under getting started, you will need the following:
- A GitHub username
- An IBM Cloud account with Pay-As-You-Go plan.
In the image above, the header on the page is titled "Hello World", we will modify it to read something else and submit a pull request inside your fork of this repository.
-
In the top-right corner of the page, click Fork.
-
In your fork, go to Settings > Secrets > Actions and create a new repository secret:
API_KEY: IBM Cloud API Key with the necessary permissions to create / delete Code Engine projects. -
Click on the <>Code tab, and then on main, create a new branch called
header-title. -
Navigate to the
webui/srcfolder and using the built-in editor on GitHub, edit theHeader.tsxfile. -
Modify line 9, from
Hello World!!toMy Code Engine Application.
-
Commit your changes.
-
Click on the Actions tab and click on
I understand my workflows, go ahead and enable them.
-
Create a pull request comparing
maintoheader-titlebranches in your forked repository. Note, by default the compare is done against the source repository, so make sure to select your forked repository on both sides of the compare. -
After submitting the pull request, the application will be built from source and deployed to Code Engine.
-
Use the URL provided to validate the application changes. Once you are satisfied, merge and close the pull request.
-
Once the pull request is closed, the application will be deleted from Code Engine.
- Target your desired region.
ibmcloud target -r us-east -g default- Create the Code Engine project.
ibmcloud code-engine project create --name ce-starter-app- Create a configmap for the list of data centers (json file).
ibmcloud code-engine configmap create \
--name random.json \
--from-file ./data/random.json - Create the application from an existing container image, expose port 3001 and map the configmap to a volume.
ibmcloud code-engine app create -n ce-starter-app \
--image <registry_host>/<registry_namespace>/ce-starter-app \
--port 3001 \
--mount-configmap /data=random.json- Optional - Update configmap
ibmcloud code-engine configmap update \
--name random.json \
--from-file ./data/random.json - Optional - Update the application from an existing container image, expose port 3001 and map the configmap to a volume.
ibmcloud code-engine app update -n ce-starter-app \
--image <registry_host>/<registry_namespace>/ce-starter-app \
--port 3001 \
--mount-configmap /data=random.json docker build -t <registry_namespace>/ce-starter-app -f ./api/Dockerfile . docker run --rm -v $(pwd)/data:/data -p 3001:3001 <registry_namespace>/ce-starter-app

