From f1ebe61647115a3cce8da64bfd2a3f6c360db5d1 Mon Sep 17 00:00:00 2001
From: jwansek <eddie.atten.ea29@gmail.com>
Date: Sun, 16 Feb 2025 17:24:27 +0000
Subject: Added Dockerfile with cronjob

---
 autoBackup/Dockerfile         | 13 +++++++++++++
 autoBackup/docker-compose.yml | 14 ++++++++++++++
 autoBackup/entrypoint.sh      |  4 ++++
 3 files changed, 31 insertions(+)
 create mode 100644 autoBackup/Dockerfile
 create mode 100644 autoBackup/docker-compose.yml
 create mode 100644 autoBackup/entrypoint.sh

(limited to 'autoBackup')

diff --git a/autoBackup/Dockerfile b/autoBackup/Dockerfile
new file mode 100644
index 0000000..1ae96da
--- /dev/null
+++ b/autoBackup/Dockerfile
@@ -0,0 +1,13 @@
+FROM ubuntu:20.04
+ENV TZ=Europe/London
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+RUN apt-get update -y
+RUN apt-get install -y python3-pip iputils-ping cron 
+COPY . /app
+WORKDIR /app
+RUN pip3 install -r requirements.txt
+RUN pip3 install -r TasmotaCLI/requirements.txt
+
+RUN echo "0 21 * * sat,wed root python3 /app/autoBackup.py > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/crontab
+ENTRYPOINT ["bash"]
+CMD ["entrypoint.sh"]
\ No newline at end of file
diff --git a/autoBackup/docker-compose.yml b/autoBackup/docker-compose.yml
new file mode 100644
index 0000000..2f43e77
--- /dev/null
+++ b/autoBackup/docker-compose.yml
@@ -0,0 +1,14 @@
+version: "3"
+
+services:
+    autoReplicate:
+        container_name: autoReplicate
+        volumes:
+            - ./logs/:/app/logs
+        env_file:
+            - ./.env
+        restart: unless-stopped
+        image: reg.reaweb.uk/autoBackup
+        build:
+            context: .
+            dockerfile: Dockerfile
\ No newline at end of file
diff --git a/autoBackup/entrypoint.sh b/autoBackup/entrypoint.sh
new file mode 100644
index 0000000..610bf84
--- /dev/null
+++ b/autoBackup/entrypoint.sh
@@ -0,0 +1,4 @@
+# https://stackoverflow.com/questions/27771781/how-can-i-access-docker-set-environment-variables-from-a-cron-job/35088810#35088810
+printenv | grep -v "no_proxy" >> /etc/environment
+
+cron -f
\ No newline at end of file
-- 
cgit v1.2.3