diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..77734f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.5-alpine +WORKDIR /maki +COPY ["requirements.txt", "*.py", "./"] +RUN pip install -r requirements.txt +CMD ["python", "./bot.py"] diff --git a/README.md b/README.md index cef6ad8..94ac144 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,11 @@ --- ## Running Maki -Maki uses Python 3.4 with discord.py. Install python3.4 and use pip to install asyncio and discord.py. -To run Maki, simply run bot.py. +Maki relies on Python 3.4+ and the latest discord.py version. +A Dockerfile exists to handle these requirements automatically. Use `build.sh` to create the maki container image, and `run.sh` to start the bot. +Be sure to have created `secret.py` with the required tokens before running `build.sh`. + +If you would prefer not to use docker, ensure you have at least Python 3.4, and use `pip install -r requirements.txt` to install the required Python libraries. Then run `bot.py`. ## Required Files - You will require a Discord Application for Maki to use, the token for which should be stored in a file called secret.py: @@ -14,10 +17,10 @@ token = '' lfmkey = '' steamkey = '' ``` -- Maki uses JSON files to store data persistently. These will be created automatically in a data directory. +- Maki uses JSON files to store data persistently. These will be created automatically in the `persist` directory. ## License -Copyright 2018, Zac Herd. +Copyright 2019, Zac Herd. All Rights Reserved. Licensed under the BSD 3-clause License. See LICENSE.md for a full copy of the license text. diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 1a41ca7..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# user to effectively run bot as (so we can safely run as root for pip) -puser="admin" - -while : -do - date - - echo Updating repository... - runuser -m $puser -c 'git pull origin master' - - # if root we can update discord.py - if [ "$EUID" -eq 0 ] - then - echo Updating discord.py... - python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice] - fi - - echo Starting Maki... - runuser -m $puser -c 'rm -f ./reload' - runuser -m $puser -c 'python3 bot.py' - - # okay to quit if there is no reload file - if [ ! -f ./reload ] - then - echo no reload file, stopping for realsies... - exit - fi -done diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c62258e --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker build -t maki . diff --git a/common.py b/common.py index 7d2b09e..b470529 100644 --- a/common.py +++ b/common.py @@ -2,7 +2,7 @@ # ---- # Discord bot by MrDetonia # -# Copyright 2018 Zac Herd +# Copyright 2019 Zac Herd # Licensed under BSD 3-clause License, see LICENSE.md for more info # IMPORTS diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..a96b401 --- /dev/null +++ b/run.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker run -v maki:/maki/persist -t maki