MangaDex Chapter checker
I've run a dumb cron-job shell script for a while now that Pulls the chapter list page from MangaDex for some set manga and pings me on Discord if any new chapters are released. It was a bit janky, but it really did the job for the year or so I ran it.
However, recently I had a friend reach out to me to see if I could extend it to also ping them if chapters were updated for a specific manga & my shell script definitely could not do that without a major refactor, so I used it as an excuse to rewrite it and learn some new stuff along the way.
The code is available on my git host if you'd like to check it out!
Building Docker Images
This is the first time I've ever built a project from scratch and wanted to have it run somewhere other than the cloud - this is a simple lightweight node script with no uptime requirements, so it's a perfect candidate to use to learn about containerising stuff!
I've used docker for years now running tools, programs and scripts other people have written, but I've never actually dockerized anything on my own since I thought it would be really daunting and difficult! In reality - making the actual image was really simple!
FROM node:20-alpine
WORKDIR /checker
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY src ./src
LABEL org.opencontainers.image.source=https://git.pfy.ch/pfych/chapter-tracker
LABEL org.opencontainers.image.description="Ping a webhook when a new MangaDex chapter is released"
LABEL org.opencontainers.image.licenses=MIT
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm run compile
CMD ["node", "./.out/build.js"]
The hard part came from the question "Now how do I run this on my NAS?".
Turns out Gitea (which is what I use to host my repos & runners) has a Container Registry component that allows you to publish images alongside a repo! I won't go into any of the actions I used to automatically build and publish the image, but it really was as simple as a few commands to publish a package to my gitea instance.
docker login git.pfy.ch
docker build -t git.pfy.ch/pfych/chapter-tracker:latest
docker push git.pfy.ch/pfych/chapter-tracker:latest
So easy!
And now I can just reference that from my compose file!
services:
checker:
image: git.pfy.ch/pfych/chapter-tracker:latest
volumes:
- "./config.json:/checker/config.json"
- "./mangaHistory.json:/checker/mangaHistory.json"
I'm definitely going to be more likely to write non-cloud scripts now that I've actually tried and succeeded in dockerizing a Node project. I'm really surprised it's taken me this long.