feat(Docker): Premiers essais pour Docker

This commit is contained in:
Olivier DOSSMANN 2022-09-30 00:32:19 +02:00
parent c94a04381d
commit 4dafa8b96d
5 changed files with 163 additions and 1 deletions

106
1.patch Normal file
View File

@ -0,0 +1,106 @@
From 669cbdb3fb1d5155ea9163269c0dcf1c2b5621ea Mon Sep 17 00:00:00 2001
From: George Rawlinson <george@rawlinson.net.nz>
Date: Tue, 27 Sep 2022 14:48:58 +1300
Subject: [PATCH 1/4] fix version info detection
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 209d5b6..6633dfd 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
from distutils.core import setup
import sys
-if sys.version_info != (3, ):
+if sys.version_info <= (3, ):
print("rawdog requires Python 3.")
sys.exit(1)
From e7a3ce41abcdb524b965f61cfdd061c94cfe0173 Mon Sep 17 00:00:00 2001
From: George Rawlinson <george@rawlinson.net.nz>
Date: Tue, 27 Sep 2022 14:49:17 +1300
Subject: [PATCH 2/4] fix missing comma
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 6633dfd..9114305 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
description="RSS Aggregator Without Delusions Of Grandeur - python3 port",
author="echarlie",
author_email="echarlie@vtluug.org",
- url="https://github.com/echarlie/rawdog-py3"
+ url="https://github.com/echarlie/rawdog-py3",
scripts=['rawdog'],
data_files=[('share/man/man1', ['rawdog.1'])],
packages=['rawdoglib'],
From 02d4c1b1dfc8fc7b3b382ae6e5f0930c9006a350 Mon Sep 17 00:00:00 2001
From: George Rawlinson <george@rawlinson.net.nz>
Date: Tue, 27 Sep 2022 20:07:05 +1300
Subject: [PATCH 3/4] fix: python version detection
Rather than using sys.version_info to detect Python version,
upstream Python recommends using python_requires, as found here:
https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires
---
setup.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/setup.py b/setup.py
index 9114305..5988b4f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,6 @@
#!/usr/bin/env python3
from distutils.core import setup
-import sys
-
-if sys.version_info <= (3, ):
- print("rawdog requires Python 3.")
- sys.exit(1)
setup(name="rawdog",
version="3.0",
@@ -15,6 +10,7 @@
url="https://github.com/echarlie/rawdog-py3",
scripts=['rawdog'],
data_files=[('share/man/man1', ['rawdog.1'])],
+ python_requires='>=3',
packages=['rawdoglib'],
classifiers=[
"Development Status :: 5 - Production/Stable",
From afbb8cda6b8b2e8a558c62cb0e20754ac6eb09e8 Mon Sep 17 00:00:00 2001
From: George Rawlinson <george@rawlinson.net.nz>
Date: Tue, 27 Sep 2022 20:09:18 +1300
Subject: [PATCH 4/4] use consistent whitespace (space to tab)
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 5988b4f..cafe463 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
url="https://github.com/echarlie/rawdog-py3",
scripts=['rawdog'],
data_files=[('share/man/man1', ['rawdog.1'])],
- python_requires='>=3',
+ python_requires='>=3',
packages=['rawdoglib'],
classifiers=[
"Development Status :: 5 - Production/Stable",

25
2.patch Normal file
View File

@ -0,0 +1,25 @@
From 48643a88e76148553af9fa3640a57e57d6ac137a Mon Sep 17 00:00:00 2001
From: George Rawlinson <george@rawlinson.net.nz>
Date: Tue, 27 Sep 2022 16:31:16 +1300
Subject: [PATCH] fix feedparser imports
---
rawdoglib/rawdog.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py
index b9d79dc..8fcba17 100644
--- a/rawdoglib/rawdog.py
+++ b/rawdoglib/rawdog.py
@@ -54,9 +54,9 @@
# The sanitisation code was restructured in feedparser 5.3.
try:
- _resolveRelativeURIs = feedparser.urls._resolveRelativeURIs
+ _resolveRelativeURIs = feedparser.urls.resolve_relative_uris
except AttributeError:
- _resolveRelativeURIs = feedparser._resolveRelativeURIs
+ _resolveRelativeURIs = feedparser.resolve_relative_uris
try:
_HTMLSanitizer = feedparser.sanitizer._HTMLSanitizer
except AttributeError:

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM python:3.7.14-alpine3.16
COPY 1.patch 2.patch /opt/
# Récupération de Rawdog
RUN apk update \
&& apk add --no-cache git patch \
&& mkdir /opt/rawdog \
&& git clone https://github.com/echarlie/rawdog-py3.git /opt/rawdog \
&& cd /opt/rawdog \
&& mv /opt/1.patch . \
&& mv /opt/2.patch . \
&& patch -p1 -i 1.patch \
&& patch -p1 -i 2.patch \
&& pip install --no-cache-dir feedparser \
&& python3 setup.py install \
&& mkdir -p /srv/http/veille
COPY public/ /srv/http/veille/
WORKDIR /opt/rawdog
VOLUME /srv/http/veille
VOLUME /root/.rawdog
VOLUME /etc/periodic/hourly
ENTRYPOINT ["crond", "-f", "-l", "8"]

5
hourly Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
UTILISATEUR=${UTILISATEUR:-1000}
/opt/rawdog/rawdog -d /root/.rawdog -uw && chown ${UTILISATEUR} /srv/http/veille -R || exit 1

View File

@ -147,7 +147,7 @@ feeditemtemplate default
# directory. Specify this as "-" to write the HTML to stdout. # directory. Specify this as "-" to write the HTML to stdout.
# (You will probably want to make this an absolute path, else rawdog will write # (You will probably want to make this an absolute path, else rawdog will write
# to a file in your ~/.rawdog directory.) # to a file in your ~/.rawdog directory.)
outputfile /srv/http/ogre/veille/index.html outputfile /srv/http/veille/index.html
#outputfile /home/you/public_html/rawdog.html #outputfile /home/you/public_html/rawdog.html
# Whether to use a <meta http-equiv="Refresh" ...> tag in the generated # Whether to use a <meta http-equiv="Refresh" ...> tag in the generated