utilities/auto-blog-link-preserver#9: Docker Container



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.1
Created: 10-Aug-24 23:14



Description

This is ultimately going to be running as a CronJob on a k8s cluster, so need to look at building a container image.



Toggle State Changes

Activity


assigned to @btasker

verified

mentioned in commit 865c3e608cee804d6bfe1f81315c3ffe1cfcc97d

Commit: 865c3e608cee804d6bfe1f81315c3ffe1cfcc97d 
Author: B Tasker                            
                            
Date: 2024-08-11T09:16:36.000+01:00 

Message

feat: create Dockerfile (utilities/auto-blog-link-preserver#9)

+18 -0 (18 lines changed)
verified

mentioned in commit c43a9f36f120e2b6e8e92be6fc6b34e710941c23

Commit: c43a9f36f120e2b6e8e92be6fc6b34e710941c23 
Author: B Tasker                            
                            
Date: 2024-08-11T09:13:37.000+01:00 

Message

feat: allow feeds.json location to be specified by env var (utilities/auto-blog-link-preserver#9)

This is in preparation for containerisation

+2 -1 (3 lines changed)

The command to run looks like this

docker run \
-it \
--rm \
-v "$PWD/feeds.json":/app/feeds.json \
-v "$PWD/hashes":/hashdir \
-e LINKWARDEN_URL="https://$DOMAIN" \
-e LINKWARDEN_TOKEN="$LINKWARDEN_TOKEN" \
-e LINKWARDEN_TAGS="SiteLinks,anti-link-rot" \
-e LINKWARDEN_COLLECTION_NAME="Site Links" \
test

If, for some reason, we wanted to put feeds.json somewhere else, we map it into that location and then set FEEDS_FILE accordinly:

docker run \
-it \
--rm \
-v "$PWD/feeds.json":/somewhere/random/feeds.json \
-e FEEDS_FILE=/somewhere/random/feeds.json \
-v "$PWD/hashes":/hashdir \
-e LINKWARDEN_URL="https://$DOMAIN" \
-e LINKWARDEN_TOKEN="$LINKWARDEN_TOKEN" \
-e LINKWARDEN_TAGS="SiteLinks,anti-link-rot" \
-e LINKWARDEN_COLLECTION_NAME="Site Links" \
test

Just for the sake of completeness, the hashdir location can also be changed via env var.

A command changing the location of both that and the feeds file might look like this

docker run \
-it \
--rm \
-v "$PWD/feeds.json":/somewhere/random/feeds.json \
-e FEEDS_FILE=/somewhere/random/feeds.json \
-e HASH_DIR="/mnt/hashdir" \
-v "$PWD/hashes":/mnt/hashdir \
-e LINKWARDEN_URL="https://$DOMAIN" \
-e LINKWARDEN_TOKEN="$LINKWARDEN_TOKEN" \
-e LINKWARDEN_TAGS="SiteLinks,anti-link-rot" \
-e LINKWARDEN_COLLECTION_NAME="Site Links" \
ghcr.io/bentasker/auto-blog-link-preserver:0.1