Docker
This commit is contained in:
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM alpine:latest
|
||||
|
||||
COPY scripts/einsaetze_rss_feed.py /usr/local/bin/
|
||||
|
||||
ENV REFRESHTIME=1800
|
||||
ENV MUSL_LOCPATH=/usr/share/i18n/locales/musl
|
||||
ENV OUTFILE=/var/rss/feed.rss
|
||||
|
||||
USER root
|
||||
RUN \
|
||||
echo '#!/bin/sh' > /usr/local/bin/einsaetze_rss_feed.sh &&\
|
||||
echo 'while true; do python3 /usr/local/bin/einsaetze_rss_feed.py > $OUTFILE; sleep $REFRESHTIME; done' >> /usr/local/bin/einsaetze_rss_feed.sh &&\
|
||||
chmod +x /usr/local/bin/einsaetze_rss_feed.sh &&\
|
||||
chmod +x /usr/local/bin/einsaetze_rss_feed.py &&\
|
||||
mkdir /var/rss &&\
|
||||
apk update &&\
|
||||
apk upgrade &&\
|
||||
apk add py3-pip &&\
|
||||
apk add py3-beautifulsoup4 &&\
|
||||
apk add py3-tz &&\
|
||||
apk add py3-requests &&\
|
||||
apk add musl musl-utils musl-locales tzdata &&\
|
||||
true
|
||||
CMD /usr/local/bin/einsaetze_rss_feed.sh
|
||||
10
README.md
10
README.md
@@ -1,11 +1,10 @@
|
||||
### about
|
||||
## about
|
||||
|
||||
python script to create a rss feed from html hosted by LFV Website Kit 2.0
|
||||
|
||||
### configuration
|
||||
* BASEURL: Homepage root
|
||||
* FWNAME: Display name
|
||||
|
||||
### usage:
|
||||
```
|
||||
/usr/bin/python einsaetze_rss_feed.py
|
||||
@@ -20,3 +19,10 @@ RSS on stdout
|
||||
* python-pytz
|
||||
* python-requests
|
||||
* locales de_DE.UTF-8
|
||||
|
||||
## Docker
|
||||
### usage
|
||||
```
|
||||
docker run -d --name einsaetze-rss-feed -v /path/to/rss/:/var/rss/ --env BASEURL=https://www.feuerwehr-nea.de --env FWNAME="Feuerwehr Nea" --env REFRESHTIME=3600 git.it-svc.de/feuerwehr-nea/einsaetze-rss-feed:latest
|
||||
```
|
||||
* REFRESHTIME: in seconds
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/python3
|
||||
import os
|
||||
import re
|
||||
import locale
|
||||
from datetime import datetime
|
||||
@@ -7,8 +8,8 @@ import requests
|
||||
from bs4 import BeautifulSoup
|
||||
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
|
||||
|
||||
BASEURL = "https://www.feuerwehr-nea.de"
|
||||
FWNAME = "Feuerwehr Nea"
|
||||
BASEURL = os.getenv("BASEURL", default="https://www.feuerwehr-nea.de")
|
||||
FWNAME = os.getenv("FWNAME", default="Feuerwehr Nea")
|
||||
|
||||
soup = BeautifulSoup(requests.get(BASEURL + "/einsaetze",timeout=20).content, 'html.parser')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user