From 416985158349bb55466914e08a3c29616396c9b2 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sun, 27 Nov 2022 16:02:54 +0100 Subject: [PATCH 1/2] Created dockerfile --- docker/Build/Dockerfile | 20 ++++++++++++++++++++ docker/Build/key.txt | 1 + docker/Build/requirements.txt | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 docker/Build/Dockerfile create mode 100644 docker/Build/key.txt create mode 100644 docker/Build/requirements.txt diff --git a/docker/Build/Dockerfile b/docker/Build/Dockerfile new file mode 100644 index 0000000..a3320a1 --- /dev/null +++ b/docker/Build/Dockerfile @@ -0,0 +1,20 @@ + +# For more information, please refer to https://aka.ms/vscode-docker-python +FROM python:3.10.0 + + +# Keeps Python from generating .pyc files in the container + +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 + +# Install pip requirements +COPY requirements.txt . +RUN pip install -r requirements.txt +RUN git clone https://github.com/Paillat-dev/Botator.git +WORKDIR /Botator/code/ +COPY key.txt /Botator/code/ +# Creates a non-root user with an explicit UID and adds permission to access the /app folder +RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /Botator/code +USER appuser +CMD ["python", "code.py"] diff --git a/docker/Build/key.txt b/docker/Build/key.txt new file mode 100644 index 0000000..027c7b4 --- /dev/null +++ b/docker/Build/key.txt @@ -0,0 +1 @@ +replace this text with your key. \ No newline at end of file diff --git a/docker/Build/requirements.txt b/docker/Build/requirements.txt new file mode 100644 index 0000000..a85e613 --- /dev/null +++ b/docker/Build/requirements.txt @@ -0,0 +1,3 @@ +# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file +py-cord[voice] +openai From 24c8b1220fa762305ba78c053f9cad08a33fe704 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sun, 27 Nov 2022 16:06:12 +0100 Subject: [PATCH 2/2] Update code.py --- code/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/code.py b/code/code.py index 6488718..ec525d4 100644 --- a/code/code.py +++ b/code/code.py @@ -10,7 +10,7 @@ def debug(message): logging.info(message) #create a database called "database.db" if the database does not exist, else connect to it -conn = sqlite3.connect('data.db') +conn = sqlite3.connect('../database/data.db') c = conn.cursor() # Create table called "data" if it does not exist with the following columns: guild_id, channel_id, api_key, is_active, max_tokens, temperature, frequency_penalty, presence_penalty, uses_count_today, prompt_size