Skip to content

Commit

Permalink
Dockerize API and Bot
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterStrick committed Nov 21, 2024
1 parent 6cc8348 commit f8b1f91
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ VERSION_API=v1.7
VERSION_BOT=v1.7

# Discord Token and Webhook
DISCORD_TOKEN=Your_Bot_Token_here
WEBHOOK_URL="https://discord.com/api/webhooks/Your_Webhook_URL_Here"
DISCORD_TOKEN=Your Bot Token here
WEBHOOK_URL="https://discord.com/api/webhooks/YOUR WebHook URL Here"

# Discord Roles
DISCORD_ROLE_OWNER=123456789
Expand All @@ -19,13 +19,13 @@ MYSQL_DB_USER=DB User with Write Privileges here
MYSQL_DB_PSWD=Password here
ENC_PSWD=Encryption Password here, recommended to be very long and complex

# Database Names
# Databases
DB_COMMENTS_PUBLIC=ViVeTool_GUI
DB_COMMENTS_API=ViVeTool_GUI_API

# Ports
API_PORT=60145
API_PORT_ALT=443

# Log File path
LOG_FILE=/absolute/path/to/a/bot.log
# Log File
LOG_FILE=/app/bot.log
31 changes: 31 additions & 0 deletions Comments/src/Template bot.env File
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Versions
VERSION_API=v1.7
VERSION_BOT=v1.7

# Discord Token and Webhook
DISCORD_TOKEN=Your Bot Token here
WEBHOOK_URL="https://discord.com/api/webhooks/YOUR WebHook URL Here"

# Discord Roles
DISCORD_ROLE_OWNER=123456789
DISCORD_ROLE_COMMENTSRW=123456789

# Images
ICON_LOGO="https://cdn.discordapp.com/attachments/992324600182620230/997055897371148298/comment.png"
ICON_CROSS="https://cdn.discordapp.com/attachments/992324600182620230/994861540442394644/cross.png"

# Database Auth
MYSQL_DB_USER=DB User with Write Privileges here
MYSQL_DB_PSWD=Password here
ENC_PSWD=Encryption Password here, recommended to be very long and complex

# Databases
DB_COMMENTS_PUBLIC=ViVeTool_GUI
DB_COMMENTS_API=ViVeTool_GUI_API

# Ports
API_PORT=60145
API_PORT_ALT=443

# Log File
LOG_FILE=/app/bot.log
Empty file added Comments/src/api.log
Empty file.
10 changes: 10 additions & 0 deletions Comments/src/api/Dockerfile-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.10.15

WORKDIR /app

RUN pip install --no-cache-dir mysql-connector-python python-dotenv Flask Flask-RESTful waitress requests pycryptodome

ADD lib /app/lib
COPY ./api .

CMD [ "python", "./vivetool_api.py" ]
File renamed without changes.
Empty file added Comments/src/bot.log
Empty file.
10 changes: 10 additions & 0 deletions Comments/src/bot/Dockerfile-bot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.10.15

WORKDIR /app

RUN pip install --no-cache-dir mysql-connector-python python-dotenv py-cord[speed] table2ascii pycryptodome

ADD lib /app/lib
COPY ./bot .

CMD [ "python", "./vivetool_bot.py" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions Comments/src/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
discord-bot:
build:
dockerfile: ./bot/Dockerfile-bot
context: .
stdin_open: true
tty: true
env_file: ./bot/bot.env
network_mode: host
restart: always
volumes:
- type: bind
source: ./bot.log
target: /app/bot.log

api:
ports:
- 60145:60145
build:
dockerfile: ./api/Dockerfile-api
context: .
stdin_open: true
tty: true
env_file: ./api/api.env
restart: always
volumes:
- type: bind
source: ./api.log
target: /app/api.log
1 change: 1 addition & 0 deletions Comments/src/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy File for Python to recognize this Folder as a Python Module
File renamed without changes.

0 comments on commit f8b1f91

Please sign in to comment.