Skip to content

Instantly share code, notes, and snippets.

@RyanGreenup
Created October 17, 2023 02:12
Show Gist options
  • Save RyanGreenup/6d5490c91e5db80f6d1acffda42ebdb6 to your computer and use it in GitHub Desktop.
Save RyanGreenup/6d5490c91e5db80f6d1acffda42ebdb6 to your computer and use it in GitHub Desktop.
Install and Run gpt4all with Docker

Install and Run gpt4all with Docker

Create directory and files

mkir gpt4all
cd gpt4all
vim -O Dockerfile docker-compose.yml

Create a docker file

FROM ubuntu

# Download the installer
RUN apt -y update; apt -y upgrade; apt -y install wget
RUN wget https://gpt4all.io/installers/gpt4all-installer-linux.run
RUN chmod +x gpt4all-installer-linux.run

# Install the dependencies
RUN DEBIAN_FRONTEND=noninteractive apt install -y xorg xorg-dev
RUN apt -y update; apt -y upgrade; apt -y install wget libfontconfig1 libdbus-1-3 libxcb-glx0  	libx11-xcb1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 libgl1
# qt5-default not packaged so install the individuals
RUN apt install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools

# The installer wants a desktop
RUN apt install -y xdg-user-dirs
RUN useradd -m user
USER user
RUN xdg-user-dirs-update

# RUN mkdir /root/Desktop/
CMD test -f /home/user/gpt4all/bin/chat || ./gpt4all-installer-linux.run; /home/user/gpt4all/bin/chat
# CMD ["tail", "-f", "/dev/null"]

Create a Compose file

version: "3"

services:
    gpt4all:
      image: gpt4all
      build: .
      environment:
        - DISPLAY=${DISPLAY}
        - PATH=${PATH}="/root/gpt4all/bin/chat:/home/user/gpt4all/bin/chat"
        - XDG_RUNTIME_DIR=/tmp/xdg_runtime_dir
      volumes:
        - /tmp/.X11-unix:/tmp/.X11-unix
          # - ./data/local/share/nomic.ai:/root/.local/share/nomic.ai/GPT4All
          # - ./data/gpt4all:/root/gpt4all
        - ./data/local/share/nomic.ai:/home/user/.local/share/nomic.ai/GPT4All
        - ./data/gpt4all:/home/user/gpt4all
      network_mode: host

Run the docker container

xhost +local:docker
docker-compose up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment