Skip to content

Instantly share code, notes, and snippets.

@tsisodia10
Last active October 24, 2023 18:44
Show Gist options
  • Save tsisodia10/1fd62db785eae54befae142ce97a6b1c to your computer and use it in GitHub Desktop.
Save tsisodia10/1fd62db785eae54befae142ce97a6b1c to your computer and use it in GitHub Desktop.

Chat Bot Application

Build image

Navigate to the openshift-ai directory --

docker build -t quay.io/<username>/<your_image_name> .

Push image to quay

docker push quay.io/<username>/<your_image_name>

Deploy on Openshift

Log in to your OpenShift cluster using oc login.

Create a new project (or use an existing one):

oc new-project openshift-ai-project

Create a secret for your OpenAI key:

Replace <your_openai_key> with your actual OpenAI API key.

apiVersion: v1
kind: Secret
metadata:
  name: openai-secret
type: Opaque
data:
  OPENAI_KEY: YOUR_BASE64_ENCODED_KEY
oc apply -f openai-secret.yaml

Create a Pod

apiVersion: v1
kind: Pod
metadata:
  name: openshift-ai-pod
  labels:
    app: openshift-ai
spec:
  containers:
  - name: openshift-ai-container
    image: 'twinkllsisodia/ai-chatbot:latest'
    ports:
      - containerPort: 7860
    env:
      - name: OPENAI_KEY
        valueFrom:
          secretKeyRef:
            name: openai-secret
            key: OPENAI_KEY
 
oc apply -f openai-pod.yaml

Port forward to access the application

oc port-forward pod/openshift-ai-pod 7860

Navigate to the browser and hit localhost:7860 Screenshot 2023-10-24 at 2 37 14 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment