aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2021-05-25 12:18:25 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2021-05-25 12:18:25 +0100
commit574635bf096f8cde0a7b825f300c326157e8e6ca (patch)
treec15fad21e24f5d749f6feb3c388846b928d71dcc
parentd15a088591460e0af9a489721165ca84770d055b (diff)
downloadyaoi-communism-574635bf096f8cde0a7b825f300c326157e8e6ca.tar.gz
yaoi-communism-574635bf096f8cde0a7b825f300c326157e8e6ca.zip
dockerised the program
-rw-r--r--Dockerfile10
-rwxr-xr-xbot.py2
-rw-r--r--crontab1
-rw-r--r--docker-compose.yml9
-rwxr-xr-xreadme.md8
5 files changed, 29 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..fb7d715
--- /dev/null
+++ b/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 crontab /etc/cron.d/oad-crontab
+RUN chmod 0644 /etc/cron.d/oad-crontab && crontab /etc/cron.d/oad-crontab
+RUN pip3 install -r requirements.txt
+ENTRYPOINT ["cron", "-f"] \ No newline at end of file
diff --git a/bot.py b/bot.py
index 5ed95eb..1148b93 100755
--- a/bot.py
+++ b/bot.py
@@ -1,5 +1,5 @@
import os
-os.chdir("/home/eden/yaoi-communism")
+os.chdir("/app")
from twython import Twython
import get_images
diff --git a/crontab b/crontab
new file mode 100644
index 0000000..5ef7b80
--- /dev/null
+++ b/crontab
@@ -0,0 +1 @@
+0 */3 * * * python3 /app/bot.py \ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..03b3bc7
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,9 @@
+version: '3'
+
+services:
+ cron:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ image: jwansek/yaoi-communism
+ network_mode: host
diff --git a/readme.md b/readme.md
index 2eff7ae..879b8f3 100755
--- a/readme.md
+++ b/readme.md
@@ -18,4 +18,12 @@ Designed to be run once an hour using a cron job.
- `python3 bot.py`
+## running in docker
+
+- `sudo docker-compose build`
+
+- `sudo docker-compose up -d`
+
+Should do everything by itself if you set the config file correctly
+
![Example image](https://pbs.twimg.com/media/EgSA-hVXoAIXLbB?format=jpg&name=large)