GeezerVison is showing ibm.github.io — The Engine Room — IBM Cloud Code Engine # IBM Cloud · Serverless · Code Engine The Engine Room.Code samples, tutorials, blog posts, and more for IBM Cloud Code Engine. $ ibmcloud ce app create \ --name my-api \ --image icr.io/codeengine/hello \ --port 8080 \ --min-scale 0 --max-scale 10 Creating application 'my-api'... ✓ Configuration OK ✓ Revision deployed ✓ Route ready URL: https://my-api.abcde.us-south .codeengine.appdomain.cloud Ready in 12s ibmcloud plugin install code-engine Code Samples Copy. Paste. Deploy.# Create the app
ibmcloud ce app create -n helloworld --image ${REGISTRY}/helloworld
# Get the URL of the app for later use
URL=$(ibmcloud ce app get -n helloworld -o url)
# Now call it
curl -w "\n%{http_code}\n" -fs $URL | tee out
Deploy an Application Create and deploy a containerized app with the Code Engine API. View on GitHub →async function runBatchJob(
projectId: string,
imageRef: string,
envVars: Record<string, string>
): Promise<string> {
// Create job definition
await codeEngineClient.createJob({
projectId,
name: "data-processor",
});
}
Submit a Batch Job Define and run a one-off or scheduled Job on Code Engine. View on GitHub →async function subscribeToStorage(
projectId: string,
appName: string,
bucketName: string
) {
const subscription = await
codeEngineClient.createSubscriptionCos({
projectId,
name: `cos-trigger-${bucketName}`,
destination: {
name: appName,
type: "app"
},
source: { bucket: bucketName },
});
}
Event Subscription Subscribe an app to IBM Cloud Object Storage events. View on GitHub →async function buildFromSource(
projectId: string,
repoUrl: string,
outputImage: string
) {
// create build config
await codeEngineClient.createBuild({
projectId,
name: "my-build",
outputImage,
sourceUrl: repoUrl,
strategyType: "dockerfile",
});
}
Build from Source Trigger a source-to-image build from a Git repo via the API. View on GitHub →# Log in and target a project
ibmcloud login --sso
ibmcloud ce project select --name my-project
# Deploy an app from a public image
ibmcloud ce app create \
--name hello \
--image icr.io/codeengine/hello \
--min-scale 0 --max-scale 10
CLI Quickstart Common ibmcloud ce commands to get productive fast. View on GitHub →ibmcloud ce app create \
--name my-translator \
--build-source . \
--build-size xlarge \
--ephemeral-storage 4G \
--memory 4G \
--cpu 2 \
--scale-down-delay 600 \
--probe-ready type=http \
--probe-ready path=/api/ping \
--probe-ready interval=5 \
--probe-ready initial-delay=10 \
--probe-ready timeout=3
AI / LLM Translator Deploy an LLM-powered translation app on Code Engine. View on GitHub →Technical Blogs Written by people who run it in production. |