mayooear / gpt4-pdf-chatbot-langchain

GPT4 & LangChain Chatbot for large PDF docs
https://www.youtube.com/watch?v=ih9PBGVVOO4
14.95k stars 3.02k forks source link

Add Docker support #296

Open spacepirate0001 opened 1 year ago

spacepirate0001 commented 1 year ago

Add Docker build to containerize the project.

psociety commented 1 year ago

Did this work for you? I believe the standard is Dockerfile not dockerfile I get several errors:

info  - Linting and checking validity of types...
/usr/share/gpt4-pdf-chatbot-langchain/config/pinecone.ts:6
  throw new Error('Missing Pinecone index name in .env file');
        ^

Error: Missing Pinecone index name in .env file
    at <anonymous> (/usr/share/gpt4-pdf-chatbot-langchain/config/pinecone.ts:6:9)
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)

ENV vars are set and still doesn't seem to grab them :s

gpt4-pdf  | /bin/sh: next: not found
gpt4-pdf  | error Command failed with exit code 127.
gpt4-pdf  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
gpt4-pdf  | 2023-06-28T14:28:40: PM2 log: App [yarn --interpreter bash start:0] exited with code [127] via signal [SIGINT]
gpt4-pdf  | 2023-06-28T14:28:40: PM2 log: Script /bin/bash had too many unstable restarts (16). Stopped. "errored"
gpt4-pdf  | 2023-06-28T14:28:41: PM2 log: 0 application online, retry = 3
gpt4-pdf  | 2023-06-28T14:28:43: PM2 log: 0 application online, retry = 2
gpt4-pdf  | 2023-06-28T14:28:45: PM2 log: 0 application online, retry = 1
gpt4-pdf  | 2023-06-28T14:28:48: PM2 log: 0 application online, retry = 0
gpt4-pdf  | 2023-06-28T14:28:48: PM2 log: Stopping app:yarn --interpreter bash start id:0
gpt4-pdf  | 2023-06-28T14:28:48: PM2 error: app=yarn --interpreter bash start id=0 does not have a pid
gpt4-pdf  | 2023-06-28T14:28:48: PM2 log: PM2 successfully stopped

A docker-compose.yml would also make the experience simplier:

version: '3'

services:
  gpt4-pdf:
    container_name: gpt4-pdf
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 3070:3000
    environment:
      OPENAI_API_KEY: WRITE_YOUR_OPENAI_KEY_HERE
      PINECONE_API_KEY: WRITE_YOUR_PINECONE_API_KEY_HERE
      PINECONE_ENVIRONMENT: WRITE_YOUR_PINECONE_ENV_HERE
      PINECONE_INDEX_NAME: WRITE_YOUR_PINECONE_INDEX_NAME_HERE
    volumes:
      - .:/usr/share/gpt4-pdf-chatbot-langchain
groovybits commented 1 year ago

I have this running in cloudrun as of a few days ago which may help contribute back to see the setup.

https://github.com/groovybits/gaib/blob/main/Dockerfile https://github.com/groovybits/gaib/blob/main/cloudbuild.yaml

https://github.com/groovybits/gaib/blob/main/CLOUDRUN.md

I actually saw this one and it helped me quite a bit craft it all to work in Cloudrun nicely. In Vercels it times out for me, although GAIB may be different in that regard than this chatbot GAIB evolved out of.