2019-12-15 22:53:40 -05:00
# Docker help for qrm2
2019-11-04 12:17:59 -05:00
2020-09-24 00:14:45 -04:00
You have multiple ways to use docker to run an instance of qrm2.
2019-12-15 22:53:40 -05:00
- [Docker help for qrm2 ](#docker-help-for-qrm2 )
- [Using docker-compose and the prebuilt-image (recommended) ](#using-docker-compose-and-the-prebuilt-image-recommended )
- [Using docker-compose and building the image ](#using-docker-compose-and-building-the-image )
- [Using pure docker ](#using-pure-docker )
- [[Optional] Building the image](#optional-building-the-image)
- [Creating the container ](#creating-the-container )
## Using docker-compose and the prebuilt-image (recommended)
This is the easiest method for running the bot without any modifications.
**Do not clone the repository when using this method!**
1. Create a new directory and `cd` into it.
2. Create the `docker-compose.yml` file:
```yaml
version: '3'
services:
qrm2:
2020-10-06 19:17:02 -04:00
image: "docker.pkg.github.com/miaowware/qrm2/qrm2:latest"
2019-12-15 22:53:40 -05:00
restart: on-failure
volumes:
- "./data:/app/data:rw"
environment:
- PYTHONUNBUFFERED=1
```
2020-10-06 19:17:02 -04:00
*Note that Github's registry requires [a few extra steps](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages) during the initial setup.*
2019-12-15 22:53:40 -05:00
3. Create a subdirectory named `data` .
4. Copy the templates for `options.py` and `keys.py` to `data/` , and edit them.
5. Run `docker-compose` :
```none
$ docker-compose pull
$ docker-compose up -d
```
2020-10-06 19:17:02 -04:00
*Run without "-d" to test the bot (run in foreground).*
2019-12-15 22:53:40 -05:00
## Using docker-compose and building the image
This is the easiest method to run the bot with modifications.
1. `cd` into the repository.
2. Create the `docker-compose.yml` file:
```yaml
version: '3'
services:
qrm2:
build: .
2020-09-24 00:14:45 -04:00
image: "qrm2:local-latest"
2019-12-15 22:53:40 -05:00
restart: on-failure
2019-11-04 12:17:59 -05:00
volumes:
2019-12-15 22:53:40 -05:00
- "./data:/app/data:rw"
environment:
- PYTHONUNBUFFERED=1
```
3. Create a subdirectory named `data` .
4. Copy the templates for `options.py` and `keys.py` to `data/` , and edit them.
5. Run `docker-compose` :
```none
$ docker-compose build --pull
2020-09-24 00:14:45 -04:00
$ docker-compose up -d
2019-12-15 22:53:40 -05:00
```
2020-10-06 19:17:02 -04:00
*Run without "-d" to test the bot (run in foreground).*
2019-12-15 22:53:40 -05:00
## Using pure docker
This methods is not very nice to use.
*I just wanna run the darn thing, not do gymnastics!*
### [Optional] Building the image
1. `cd` into the repository.
2. Run docker build:
```none
2020-09-24 00:14:45 -04:00
$ docker build -t qrm2:local-latest .
2019-12-15 22:53:40 -05:00
```
### Creating the container
1. Be in a directory with a `data/` subdirectory, which should contain valid `options.py` and `keys.py` files (copy and edit the templates).
2. Run the container:
```none
$ docker run -d --rm --mount type=bind,src=$(pwd)/data,dst=/app/data --name qrm2 [image]
```
2019-12-15 23:59:13 -05:00
Where `[image]` is either of:
2020-10-06 19:17:02 -04:00
- `qrm2:local-latest` if you are building your own.
- `docker.pkg.github.com/miaowware/qrm2/qrm2:latest` if you want to use the prebuilt image.