Implement building with docker

See the README for usages and details.

A breaking changes here too:
* run.py is gone, we now handle that kind of thing with docker
* The token is out of the config and is now an ENVAR (ideally using a .env)
* `.json` files are now in a .matchy/ subdirectory, as this makes it a lot easier for the container to safely read

Bonus:
* fix a score_factors.setdefault call causing issues
* Reformat some of the readme
This commit is contained in:
Marc Di Luzio 2024-08-14 16:55:23 +01:00
parent b810dedb26
commit 3a0bf82ecb
10 changed files with 174 additions and 95 deletions

View file

@ -4,12 +4,12 @@
import logging
import discord
from discord.ext import commands
import config
import os
from state import load_from_file
from cogs.matchy_cog import MatchyCog
from cogs.owner_cog import OwnerCog
_STATE_FILE = "state.json"
_STATE_FILE = ".matchy/state.json"
state = load_from_file(_STATE_FILE)
logger = logging.getLogger("matchy")
@ -35,4 +35,6 @@ async def on_ready():
if __name__ == "__main__":
handler = logging.StreamHandler()
bot.run(config.Config.token, log_handler=handler, root_logger=True)
token = os.environ.get("TOKEN", None)
assert token, "$TOKEN required"
bot.run(token, log_handler=handler, root_logger=True)