docker: improved Dockerfile, changed logging

This commit is contained in:
A.M. Rowsell 2025-03-14 12:04:40 -04:00
commit 686decaccf
Signed by untrusted user who does not match committer: amr
GPG key ID: 0B6E2D8375CF79A9
2 changed files with 18 additions and 8 deletions

View file

@ -1,10 +1,19 @@
# DiscoRSS Dockerfile
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
FROM python:3.13.2-alpine3.21
WORKDIR /usr/src/app
COPY discorss.py ./
COPY discorss.conf /etc/
RUN mkdir /root/.config
RUN mkdir /root/.config/discorss
COPY discorss.conf /root/.config/discorss
RUN pip install --no-cache-dir requests feedparser
CMD [ "python", "discorss.py" ]
CMD [ "python", "discorss.py" ]
LABEL author="A.M. Rowsell <https://frzn.dev/~amr>"

View file

@ -8,7 +8,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# DiscoRSS: A simple RSS feed reader for Discord. Takes RSS feeds and then sends them to
# webhooks. Intended to run using systemd timers.
# webhooks. Intended to run using systemd timers, or as a Docker container.
import requests
import feedparser
@ -103,7 +103,7 @@ def setupPaths():
logging.basicConfig(
filename=str(log_dir + log_file_path),
encoding="utf-8",
level=logging.INFO,
level=logging.WARNING,
datefmt="%m/%d/%Y %H:%M:%S",
format="%(asctime)s: %(levelname)s: %(message)s",
)
@ -138,7 +138,7 @@ def main():
else:
continue
if bad_time is True:
logger.warning(
logger.info(
"Feed %s doesn't supply a published time, using updated time instead",
hook["name"],
)
@ -212,9 +212,10 @@ def main():
if __name__ == "__main__":
if os.environ["INVOCATION_ID"]:
main()
else:
try:
if os.environ["INVOCATION_ID"]:
main()
except KeyError:
try:
while True:
main()