From 7d73660361d0ce7ec80b980e55790ad076d57994 Mon Sep 17 00:00:00 2001 From: Rene Teigen Date: Sun, 19 Feb 2023 22:14:06 +0000 Subject: [PATCH] Add to docker instructions --- detailed_guides/INSTALLATION.md | 51 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/detailed_guides/INSTALLATION.md b/detailed_guides/INSTALLATION.md index d1ae224..ee3159d 100644 --- a/detailed_guides/INSTALLATION.md +++ b/detailed_guides/INSTALLATION.md @@ -121,34 +121,30 @@ cd GPT3Discord python3.9 gpt3discord.py ``` - ### Docker and Docker Compose : -To use docker you can use the following command -``` -docker run -d --name gpt3discord -v /containers/gpt3discord:/data -v /containers/gpt3discord/share:/data/share --env-file /path/to/.env ghcr.io/kav-k/gpt3discord:main + +To use docker you can use the following command after [installing docker](https://docs.docker.com/get-docker/) +- Make a .env file to mount to `/opt/gpt3discord/etc/environment` in docker +- `env_file` in the command should be replaced with where you have your .env file stored on your machine +The parts enclosed in [ ] is optional, read below for information +```shell +docker run -d --name gpt3discord env_file:/opt/gpt3discord/etc/environment [-v /containers/gpt3discord:/data] [-v /containers/gpt3discord/share:/data/share] ghcr.io/kav-k/gpt3discord:main ``` -Make sure that the /data and /data/share are created and the `env-file` path is correct. +If you wish to build your own image then do the following commands instead +```shell +# build the image +docker build -t gpt3discord . +# run it +docker run -d --name gpt3discord env_file:/opt/gpt3discord/etc/environment [-v /containers/gpt3discord:/data] [-v /containers/gpt3discord/share:/data/share] gpt3discord +``` + +- Optional: Make a data and share directory then mount it to docker to keep persistent data + - Add `-v DATA_DIR=/data` to command -> `usage.txt` is saved here + - Add `-v SHARE_DIR=/data/share` to command -> this is where `conversation starters, optimizer pretext and the 'openers' folder` is alternatively loaded from + - If `SHARE_DIR` is not included it'll load only from the files added during the docker image build + +Make sure the `env_file` path is correct and the `DATA_DIR` and `SHARE_DIR` paths exists on your machine if used. #### Docker Compose @@ -163,8 +159,9 @@ To use Docker Compose, you need to have Docker and Docker Compose installed on y To start the gpt3discord container with Docker Compose, follow these steps: 1. Open a terminal or command prompt and navigate to the directory that contains the docker-compose.yml file. -2. Open the docker-compose.yml file and replace the environment variable values with your actual tokens and IDs. -3. Run the following command to start the container in detached mode: +2. Open the docker-compose.yml file and replace the environment variable values with your actual tokens and IDs. +3. In the docker-compose.yml replace the volumes with a path on your machine if you don't use the ones listed, the path to replace is the one on the left side of the colon. +4. Run the following command to start the container in detached mode: ``` docker-compose up -d