diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9a86877 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/venv/ +/.github/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..992139e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.12-alpine3.21 +WORKDIR /usr/src/app +COPY . . +RUN pip install -r requirements.txt +CMD ["python", "-m", "amulet_discord_bot"] diff --git a/amulet_discord_bot/bot.py b/amulet_discord_bot/bot.py index 2adfe6b..f2e1d7a 100644 --- a/amulet_discord_bot/bot.py +++ b/amulet_discord_bot/bot.py @@ -241,11 +241,11 @@ async def on_raw_message_edit(self, payload: discord.RawMessageUpdateEvent) -> N def main() -> None: parser = argparse.ArgumentParser(description="Run the Amulet Discord bot.") - parser.add_argument("bot_token", type=str) + parser.add_argument("bot_token", type=str, nargs="?") args = parser.parse_args() intents = discord.Intents.default() intents.members = True intents.message_content = True client = AmuletBot(intents=intents) - client.run(args.bot_token) + client.run(args.bot_token or os.environ["BOT_TOKEN"]) diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..76069d1 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,6 @@ +services: + amulet-discord-bot: + image: amulet-discord-bot + restart: unless-stopped + environment: + - BOT_TOKEN=${BOT_TOKEN}