diff options
-rwxr-xr-x | .gitignore | 1 | ||||
-rwxr-xr-x | SmallYTChannelDatabase.db | bin | 27417600 -> 0 bytes | |||
-rw-r--r-- | docker-compose.yml | 14 | ||||
-rw-r--r-- | onceaday/Dockerfile | 10 | ||||
-rw-r--r-- | onceaday/crontab | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | onceaday/onceaday.py (renamed from onceaday.py) | 7 | ||||
-rw-r--r-- | onceaday/requirements.txt (renamed from oadrequirements.txt) | 0 | ||||
-rwxr-xr-x | readme.md | 8 |
8 files changed, 35 insertions, 6 deletions
@@ -6,6 +6,7 @@ chblacklist.txt api.log config.json *.log +*.db # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/SmallYTChannelDatabase.db b/SmallYTChannelDatabase.db Binary files differdeleted file mode 100755 index aa102d9..0000000 --- a/SmallYTChannelDatabase.db +++ /dev/null diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..171539e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' + +services: + sytc: + build: + context: . + dockerfile: Dockerfile + image: jwansek/smallytchannelbot + network_mode: host + cron: + build: + context: . + dockerfile: ./onceaday/Dockerfile + network_mode: host
\ No newline at end of file diff --git a/onceaday/Dockerfile b/onceaday/Dockerfile new file mode 100644 index 0000000..b737d90 --- /dev/null +++ b/onceaday/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:latest +MAINTAINER Eden Attenborough "eddie.atten.ea29@gmail.com" +RUN apt-get update -y +RUN apt-get install -y tzdata python3-pip python-dev build-essential pkg-config cron +COPY . /app +WORKDIR /app +COPY onceaday/crontab /etc/cron.d/oad-crontab +RUN chmod 0644 /etc/cron.d/oad-crontab && crontab /etc/cron.d/oad-crontab +RUN pip3 install -r onceaday/requirements.txt +ENTRYPOINT ["cron", "-f"]
\ No newline at end of file diff --git a/onceaday/crontab b/onceaday/crontab new file mode 100644 index 0000000..c8ce32a --- /dev/null +++ b/onceaday/crontab @@ -0,0 +1 @@ +@daily python3 /app/onceaday/onceaday.py /app/onceaday diff --git a/onceaday.py b/onceaday/onceaday.py index 1570c9a..97705c7 100755..100644 --- a/onceaday.py +++ b/onceaday/onceaday.py @@ -1,7 +1,10 @@ import os -from operator import itemgetter -os.chdir("/home/eden/SmallYTChannelBotSubmissions") +import sys + +os.chdir(sys.argv[1]) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) +from operator import itemgetter import subreddit import database import datetime diff --git a/oadrequirements.txt b/onceaday/requirements.txt index 23c2cef..23c2cef 100644 --- a/oadrequirements.txt +++ b/onceaday/requirements.txt @@ -8,13 +8,13 @@ The source code for /u/SmallYTChannelBot. - Edit the configuration file and rename -- Build the image: +- Build the images: -`sudo docker build -t smallytchannelbot:latest .` +`sudo docker-compose build` -- Start the container: +- Start the containers: -`sudo docker run --name smallytchannelbot --net=host -d smallytchannelbot` +`sudo docker-compose up -d` # TODOs |