From 05e53a3cfe46467580205a7c1b10f570c4b760c3 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 21 Apr 2021 21:05:11 -0400 Subject: [PATCH 1/5] Idea --- Dockerfile | 2 +- Dockerfile_standalone_DiscordScript | 10 ++++++++++ Dockerfile_standalone_TwitchScript | 10 ++++++++++ Dockerfile_standalone_command | 10 ++++++++++ docker-compose.yaml | 16 ++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 Dockerfile_standalone_DiscordScript create mode 100644 Dockerfile_standalone_TwitchScript create mode 100644 Dockerfile_standalone_command create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile index 3f7084b..be856a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,4 @@ RUN pip3 install -r requirements.txt COPY . . -CMD [ "python3", "main.py"] #Uncomment to start with the Docker Container \ No newline at end of file +CMD [ "python3", "main.py"] \ No newline at end of file diff --git a/Dockerfile_standalone_DiscordScript b/Dockerfile_standalone_DiscordScript new file mode 100644 index 0000000..c25b1f0 --- /dev/null +++ b/Dockerfile_standalone_DiscordScript @@ -0,0 +1,10 @@ +FROM python:3.8-buster + +WORKDIR /Praxis + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt + +COPY . . + +CMD [ "python3", "discord_script_standalone.py"] \ No newline at end of file diff --git a/Dockerfile_standalone_TwitchScript b/Dockerfile_standalone_TwitchScript new file mode 100644 index 0000000..02056ff --- /dev/null +++ b/Dockerfile_standalone_TwitchScript @@ -0,0 +1,10 @@ +FROM python:3.8-buster + +WORKDIR /Praxis + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt + +COPY . . + +CMD [ "python3", "twitch_script_standalone.py"] \ No newline at end of file diff --git a/Dockerfile_standalone_command b/Dockerfile_standalone_command new file mode 100644 index 0000000..c0e9965 --- /dev/null +++ b/Dockerfile_standalone_command @@ -0,0 +1,10 @@ +FROM python:3.8-buster + +WORKDIR /Praxis + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt + +COPY . . + +CMD [ "python3", "standalone_command.py"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..02d31c4 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +version: '3.7' +services: + standalone_command: + image: standalone_command + ports: + - 5000:5000 + environment: + - ISDOCKER=cat + twitchscript_standalone: + image: twitchscript_standalone + environment: + - ISDOCKER=cat + discordscript_standalone: + image: discordscript_standalone + environment: + - ISDOCKER=cat \ No newline at end of file From 7abeeca523868ca192929fa3974ca0709166d954 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 21 Apr 2021 21:15:37 -0400 Subject: [PATCH 2/5] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7de009..7277a96 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,14 @@ ___ Run the following to enable these V2 modules. `python standalone_command.py`
-`python twitch_script_standalone`
-`python discord_script_standalone`
+`python twitch_script_standalone.py`
+`python discord_script_standalone.py`
+ +## Docker: + +### Image Setup: + +### Docker-Compose Info: ___ From 81a51a26a1239d58f236b83ecc4342d94e08c8d6 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 21 Apr 2021 21:20:11 -0400 Subject: [PATCH 3/5] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7277a96..1d88896 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,17 @@ Run the following to enable these V2 modules. ### Image Setup: +Use these commands to build the images.
+`docker build --file Dockerfile_standalone_command --tag standalone_command .`
+`docker build --file Dockerfile_standalone_TwitchScript --tag twitchscript_standalone .`
+`docker build --file Dockerfile_standalone_DiscordScript --tag discordscript_standalone .`
+ ### Docker-Compose Info: +To Start: +`docker-compose up`
+To Stop: +`docker-compose down`
___ ~~# V1 Info:~~ From a54686d07a3dcc7d53e932deabaef73b89e71878 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 21 Apr 2021 21:33:30 -0400 Subject: [PATCH 4/5] docker fix --- discord_script_standalone.py | 4 ++-- twitch_script_standalone.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/discord_script_standalone.py b/discord_script_standalone.py index c47d723..c71a971 100644 --- a/discord_script_standalone.py +++ b/discord_script_standalone.py @@ -85,14 +85,14 @@ class Discord_Module(discord.Client): async def is_command(self, word: str) -> bool: # todo need to url-escape word clean_param = urlencode({'name': word}) - url = "http://localhost:5000/api/v1/command?%s" % clean_param + url = "http://standalone_command:5000/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 async def exec_command(self, realMessage: discord.Message, command: str, rest: str): # todo need to url-escape command and rest params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Discord, 'user_name': realMessage.author.mention, 'command_name': command, 'rest': rest, 'bonus_data': realMessage}) - url = "http://localhost:5000/api/v1/exec?%s" % params + url = "http://standalone_command:5000/api/v1/exec?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/twitch_script_standalone.py b/twitch_script_standalone.py index 867074a..03eac64 100644 --- a/twitch_script_standalone.py +++ b/twitch_script_standalone.py @@ -69,14 +69,14 @@ class Twitch_Module(): def is_command(self, word: str) -> bool: # todo need to url-escape word clean_param = urlencode({'name': word}) - url = "http://localhost:5000/api/v1/command?%s" % clean_param + url = "http://standalone_command:5000/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 def exec_command(self, realMessage: twitch.chat.Message, command: str, rest: str): # todo need to url-escape command and rest params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Twitch,'user_name': realMessage.sender, 'command_name': command, 'rest': rest, 'bonus_data': realMessage}) - url = "http://localhost:5000/api/v1/exec?%s" % params + url = "http://standalone_command:5000/api/v1/exec?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) From c708f57347dceae613d9397f7d0611f3b273f896 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 21 Apr 2021 21:38:22 -0400 Subject: [PATCH 5/5] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d88896..a7204e2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ ___ ## Usage: -Run the following to enable these V2 modules. +Run the following to enable these V2 modules without Docker. (After you install requirements)
+`pip install -r requirements.txt`
`python standalone_command.py`
`python twitch_script_standalone.py`