Add to docker instructions

Rene Teigen 1 year ago
parent 160c98baa9
commit 7d73660361

@ -121,34 +121,30 @@ cd GPT3Discord
python3.9 gpt3discord.py
```
<!--
### Docker Installation
We now have a `Dockerfile` in the repository. This will build / install all dependencies and put a `gpt3discord` binary (main.py) into path.
To build:
- [Install docker](https://docs.docker.com/get-docker/)
- Clone repository and build *(hopefully eventually we'll add CI to automatically build + push to docker hub)*
- `docker build -t gpt3discord .`
- *From repository root or supply path to repository*
- Make a .env file to bind mount to `/opt/gpt3discord/etc/environment`
- Optional: Make a data directory + bind mount it
- Add `DATA_DIR=/data` to env file -> `usage.txt` is made here
- Add `SHARE_DIR=/data/share` to env file -> this is where `conversation starters, optimizer pretext and the 'openers' folder` is loaded from
- If `SHARE_DIR` is not included it'll load from the files added during the docker image build
- Run via docker:
- `docker run [-d] --name gpt3discord -v env_file:/opt/gpt3discord/etc/environment [-v /containers/gpt3discord:/data] [-v /containers/gpt3discord/share:/data/share] gpt3discord`
- You can also mount extra volumes and set `DATA_DIR` and `SHARE_DIR` in the env file to keep persistent data
- `env_file` should be replaced with where you have your .env file stored on your machine
This can also be run via screen/tmux or detached like a daemon. -->
### 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

Loading…
Cancel
Save