diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-29 14:08:56 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-29 14:08:56 +0000 |
commit | 51502a433353ba1bf034a22be9bdf7569531e2f5 (patch) | |
tree | 76d3eb6fa55d574785167b72d7a7f2f628d7a3d7 | |
parent | d647ebb3adc73e0fb2b81b8661bab94fbace8520 (diff) | |
download | tagrss-51502a433353ba1bf034a22be9bdf7569531e2f5.tar tagrss-51502a433353ba1bf034a22be9bdf7569531e2f5.tar.gz tagrss-51502a433353ba1bf034a22be9bdf7569531e2f5.zip |
Add Dockerfile, a bit more logging
-rw-r--r-- | .dockerignore | 3 | ||||
-rw-r--r-- | Dockerfile | 10 | ||||
-rwxr-xr-x | serve.py | 22 |
3 files changed, 31 insertions, 4 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fa064c4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +/__pycache__/ +/venv/ +/ignore/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61ce76f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.11-bookworm + +RUN mkdir /tagrss_data/ +COPY . /tagrss +WORKDIR /tagrss +RUN pip install -r requirements.txt + +EXPOSE 8000 + +CMD ["./serve.py", "--host", "0.0.0.0", "--storage-path", "/tagrss_data/tagrss_data.db"] @@ -71,20 +71,33 @@ def index(): per_page: int = min(MAX_PER_PAGE_ENTRIES, int(bottle.request.query.get("per_page", DEFAULT_PER_PAGE_ENTRIES))) # type: ignore page_num = int(bottle.request.query.get("page_num", 1)) # type: ignore offset = (page_num - 1) * per_page - included_feeds_str: typing.Optional[str] = bottle.request.query.get("included_feeds", None) # type: ignore + included_feeds_str: typing.Optional[str] = bottle.request.query.get("included_feeds", None) # type: ignore included_feeds: typing.Optional[list[int]] = None if included_feeds_str: try: included_feeds = [int(feed_id) for feed_id in included_feeds_str.split(" ")] except ValueError: pass - included_tags_str: typing.Optional[str] = bottle.request.query.get("included_tags", None) # type: ignore + included_tags_str: typing.Optional[str] = bottle.request.query.get("included_tags", None) # type: ignore included_tags: typing.Optional[list[str]] = None if included_tags_str: included_tags = parse_space_separated_tags(included_tags_str) with core_lock: - total_pages: int = max(1, math.ceil(core.get_entry_count(included_feeds=included_feeds, included_tags=included_tags) / per_page)) - entries = core.get_entries(limit=per_page, offset=offset, included_feeds=included_feeds, included_tags=included_tags) + total_pages: int = max( + 1, + math.ceil( + core.get_entry_count( + included_feeds=included_feeds, included_tags=included_tags + ) + / per_page + ), + ) + entries = core.get_entries( + limit=per_page, + offset=offset, + included_feeds=included_feeds, + included_tags=included_tags, + ) return bottle.template( "index", entries=entries, @@ -145,6 +158,7 @@ def add_feed_effect(): except tagrss.FeedAlreadyAddedError: already_present = True # TODO: handle FeedFetchError too + logging.info(f"Added feed {feed_source} .") return bottle.template( "add_feed", after_add=True, |