Skip to content

Commit

Permalink
add k8s config (mckaywrigley#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
logycon authored Mar 25, 2023
1 parent c73f604 commit 4876dce
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include .env

.PHONY: all

build:
docker build -t chatbot-ui .

run:
export $(cat .env | xargs)
docker stop chatbot-ui || true && docker rm chatbot-ui || true
docker run --name chatbot-ui --rm -e OPENAI_API_KEY=${OPENAI_API_KEY} -p 3000:3000 chatbot-ui

logs:
docker logs -f chatbot-ui

push:
docker tag chatbot-ui:latest ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
docker push ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
60 changes: 60 additions & 0 deletions k8s/chatbot-ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: v1
kind: Namespace
metadata:
name: chatbot-ui
---
apiVersion: v1
kind: Secret
metadata:
namespace: chatbot-ui
name: chatbot-ui
type: Opaque
data:
OPENAI_API_KEY: <base64 encoded key>
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: chatbot-ui
name: chatbot-ui
labels:
app: chatbot-ui
spec:
replicas: 1
selector:
matchLabels:
app: chatbot-ui
template:
metadata:
labels:
app: chatbot-ui
spec:
containers:
- name: chatbot-ui
image: <docker user>/chatbot-ui:latest
resources: {}
ports:
- containerPort: 3000
env:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: chatbot-ui
key: OPENAI_API_KEY
---
kind: Service
apiVersion: v1
metadata:
namespace: chatbot-ui
name: chatbot-ui
labels:
app: chatbot-ui
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 3000
selector:
app: chatbot-ui
type: ClusterIP

0 comments on commit 4876dce

Please sign in to comment.