|
| 1 | +#!/bin/bash |
| 2 | +# Build and Deploy Custom DeepWiki Image |
| 3 | + |
| 4 | +set -e |
| 5 | + |
| 6 | +# Configuration |
| 7 | +REGISTRY="registry.digitalocean.com/codequal" |
| 8 | +IMAGE_NAME="deepwiki-custom" |
| 9 | +TAG="latest" |
| 10 | +FULL_IMAGE="${REGISTRY}/${IMAGE_NAME}:${TAG}" |
| 11 | + |
| 12 | +# Get the directory of this script |
| 13 | +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 14 | + |
| 15 | +echo "🔨 Building custom DeepWiki image..." |
| 16 | +cd ${SCRIPT_DIR} |
| 17 | +docker build -t ${FULL_IMAGE} . |
| 18 | + |
| 19 | +echo "📤 Pushing to registry..." |
| 20 | +docker push ${FULL_IMAGE} |
| 21 | + |
| 22 | +echo "📦 Creating updated deployment..." |
| 23 | +cat > ../deepwiki-deployment-custom.yaml << EOF |
| 24 | +apiVersion: apps/v1 |
| 25 | +kind: Deployment |
| 26 | +metadata: |
| 27 | + name: deepwiki |
| 28 | + namespace: codequal-dev |
| 29 | + labels: |
| 30 | + app: deepwiki |
| 31 | +spec: |
| 32 | + replicas: 1 |
| 33 | + selector: |
| 34 | + matchLabels: |
| 35 | + app: deepwiki |
| 36 | + template: |
| 37 | + metadata: |
| 38 | + labels: |
| 39 | + app: deepwiki |
| 40 | + spec: |
| 41 | + containers: |
| 42 | + - name: deepwiki |
| 43 | + image: ${FULL_IMAGE} |
| 44 | + imagePullPolicy: Always |
| 45 | + ports: |
| 46 | + - containerPort: 3000 |
| 47 | + name: frontend |
| 48 | + - containerPort: 8001 |
| 49 | + name: api |
| 50 | + env: |
| 51 | + - name: SERVER_BASE_URL |
| 52 | + value: http://deepwiki-api:8001 |
| 53 | + - name: NEXT_PUBLIC_SERVER_BASE_URL |
| 54 | + value: http://deepwiki-api:8001 |
| 55 | + |
| 56 | + # API Keys |
| 57 | + - name: OPENROUTER_API_KEY |
| 58 | + valueFrom: |
| 59 | + secretKeyRef: |
| 60 | + name: deepwiki-api-keys |
| 61 | + key: OPENROUTER_API_KEY |
| 62 | + - name: OPENAI_API_KEY |
| 63 | + valueFrom: |
| 64 | + secretKeyRef: |
| 65 | + name: deepwiki-api-keys |
| 66 | + key: OPENAI_API_KEY |
| 67 | + - name: GITHUB_TOKEN |
| 68 | + valueFrom: |
| 69 | + secretKeyRef: |
| 70 | + name: deepwiki-api-keys |
| 71 | + key: GITHUB_TOKEN |
| 72 | + optional: true |
| 73 | + |
| 74 | + # Model configuration via environment |
| 75 | + - name: OPENAI_BASE_URL |
| 76 | + value: https://api.openai.com/v1 |
| 77 | + - name: LLM_MODEL |
| 78 | + value: openai/gpt-4-turbo-preview |
| 79 | + - name: EMBEDDING_MODEL |
| 80 | + value: text-embedding-3-large |
| 81 | + - name: EMBEDDING_API_BASE |
| 82 | + value: https://api.openai.com/v1 |
| 83 | + - name: EMBEDDING_DIMENSIONS |
| 84 | + value: "3072" |
| 85 | + |
| 86 | + resources: |
| 87 | + requests: |
| 88 | + memory: "1Gi" |
| 89 | + cpu: "250m" |
| 90 | + limits: |
| 91 | + memory: "2Gi" |
| 92 | + cpu: "1" |
| 93 | + volumeMounts: |
| 94 | + - mountPath: /root/.adalflow |
| 95 | + name: deepwiki-data |
| 96 | + volumes: |
| 97 | + - name: deepwiki-data |
| 98 | + persistentVolumeClaim: |
| 99 | + claimName: deepwiki-data |
| 100 | + imagePullSecrets: |
| 101 | + - name: registry-codequal |
| 102 | +EOF |
| 103 | + |
| 104 | +echo "🚀 Deploying custom DeepWiki..." |
| 105 | +kubectl apply -f ../deepwiki-deployment-custom.yaml |
| 106 | + |
| 107 | +echo "✅ Done! Custom DeepWiki image deployed." |
| 108 | +echo "" |
| 109 | +echo "Next steps:" |
| 110 | +echo "1. Wait for pod to be ready: kubectl wait --for=condition=Ready pod -l app=deepwiki -n codequal-dev" |
| 111 | +echo "2. Check logs: kubectl logs -n codequal-dev -l app=deepwiki" |
| 112 | +echo "3. Test with: cd ../../packages/agents && npx ts-node test-deepwiki-simple.ts" |
0 commit comments