changed docker for better persistence

This commit is contained in:
socrates
2023-12-12 12:36:36 +01:00
parent db51753ff9
commit 5cc27ca6b9
5 changed files with 22 additions and 8 deletions

View File

@@ -1,16 +1,18 @@
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y cron tzdata python3-openpyxl python3-selenium python3-pyvirtualdisplay && rm -rf /var/lib/apt/lists/*
RUN apt update && apt install -y vim cron tzdata python3-openpyxl python3-selenium python3-pyvirtualdisplay && rm -rf /var/lib/apt/lists/*
RUN cp -r -f /usr/share/zoneinfo/Europe/Berlin /etc/localtime
COPY . /app/
COPY /parser.py /app/
COPY /kill-chrome.sh /app/
COPY /run.sh /app/
COPY /init /app/init
RUN mkdir -p /app/files
RUN mkdir -p /app/log
RUN mkdir -p /app/conf
RUN chmod +x /app/run.sh
RUN chmod +x /app/kill-chrome.sh
WORKDIR /app/
RUN crontab conf/crontab
CMD [ "cron", "-f" ]
CMD [ "/app/run.sh" ]

View File

@@ -1,3 +1,3 @@
# m h dom mon dow cmd
*/5 8-20 * * 1-5 cd /app/ && ./parser.py
0 0 * * * /app/kill-chrome
0 0 * * * /app/kill-chrome.sh

12
run.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
if ! test -f "/app/conf/crontab"; then
cp "/app/init/crontab" "/app/conf/crontab"
fi
crontab "/app/conf/crontab"
if ! test -f "/app/conf/conf.json"; then
cp "/app/init/conf.json" "/app/conf/conf.json"
fi
cron -f