node-chatgpt-api icon indicating copy to clipboard operation
node-chatgpt-api copied to clipboard

Add Dockerfile so this can be run under Docker

Open bertybuttface opened this issue 3 years ago • 6 comments

This is a good reference and I know it works on both ARM64 and AMD64: https://github.com/matrixgpt/matrix-chatgpt-bot/blob/main/Dockerfile

bertybuttface avatar Jan 12 '23 03:01 bertybuttface

I don't use Docker much, so PRs are welcome from people more experienced in this matter.

waylaidwanderer avatar Jan 12 '23 03:01 waylaidwanderer

i am working on a DockerFile @waylaidwanderer @bertybuttface but it seems not to be able to a find a specific selector

`FROM satantime/puppeteer-node:19-slim

We don't need the standalone Chromium

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable ENV CHROME_PATH=/usr/bin/google-chrome-stable ENV DEBIAN_FRONTEND=noninteractive

Install Google Chrome Stable and fonts

Note: this installs the necessary libs to make the browser work with Puppeteer.

RUN apt-get update && apt-get install gnupg wget xvfb gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils libgbm-dev -y &&
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg &&
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' &&
apt-get update &&
apt-get install google-chrome-stable -y --no-install-recommends &&
rm -rf /var/lib/apt/lists/*

COPY . /src

WORKDIR /src

RUN npm install -production

EXPOSE 3000

CMD xvfb-run npm start`

Error: │ TimeoutError: Waiting for selector #__next .btn-primary failed: Waiting failed: 180000ms exceeded

thearchitectxy avatar Jan 14 '23 11:01 thearchitectxy

I forked the repo and create a Dockerfile and docker-compose as in https://github.com/tuannm151/node-chatgpt-api. The server only listen on localhost so I have to change it to listen on all interface.

tuannm151 avatar Jan 20 '23 19:01 tuannm151

I forked the repo and create a Dockerfile and docker-compose as in https://github.com/tuannm151/node-chatgpt-api. The server only listen on localhost so I have to change it to listen on all interface.

This works well, I've been using it via docker-compose with:

version: '3.3'
services:
  chatgpt-api:
    command: "supervisord -c /app/supervisord.conf"
    container_name: chatgpt-api
    ports:
      - "3000:3000"
    build: https://github.com/tuannm151/node-chatgpt-api.git#main
    volumes:
      - './chatgpt-settings.js:/app/settings.js'

I was getting some permissions errors with the entrypoint script but the command line above solved that.

bertybuttface avatar Jan 23 '23 15:01 bertybuttface

Thanks guys; I'll take a look and see if I can get it running using Docker too.

waylaidwanderer avatar Jan 23 '23 16:01 waylaidwanderer

This is an example of how something like this could be included in a project easily so the two parts are decoupled:

https://github.com/MatrixLLM/matrix-llm-bot

bertybuttface avatar Jan 23 '23 16:01 bertybuttface

https://github.com/queercat/gpt-api-docker attempts to resolve this. Docker deployment currently works and can be sent to something like fly-io fairly trivially. Once #20 is resolved the Dockerfile will rely solely upon this repo and be fully stable.

out

queercat avatar Feb 04 '23 11:02 queercat