Skip to content

feat: Docker image on GHCR for scheduled backups on your own server - #55

Merged
supertj merged 3 commits into
mainfrom
feature/docker-image
Nov 4, 2026
Merged

supertj merged 3 commits into
mainfrom
feature/docker-image

Conversation

@supertj

@supertj supertj commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Adds a container image so backups can run on a home server, NAS or Unraid box instead of GitHub Actions.

  • Dockerfile: builds the CLI from this repo's source on node:24-alpine3.24, with pg_dump/pg_restore/psql 17 (same major as the GitHub Action; a pg_dump 18 archive can't be read by pg_restore 17). Runs as the non-root node user. No credentials in the image; config is env-only, same BACKUPDRILL_* variables as the CLI.
  • docker/entrypoint.sh: with BACKUPDRILL_CRON set, supercronic runs backupdrill backup on that schedule (honours TZ, skips a run while the previous one is still going). Without it, one backup and exit with the CLI's exit code. Arguments go straight to the CLI. Only a standard 5-field expression or an @ shortcut is accepted; anything else exits 64 at start, because supercronic -test alone accepts comments, VAR=value lines and 0 3 * * * foo, which would leave the container running without a backup job.
  • .github/workflows/docker-image.yml: on PRs, builds and smoke-tests (version matches package.json, pg_dump 17, bad schedules exit 64, missing config fails fast). On main only, pushes ghcr.io/backupdrill/backupdrill:latest, :<version>, :sha-<commit> for amd64 and arm64.
  • README: Docker section.

Tested locally (OrbStack): one-shot backup and * * * * * scheduled backup against Postgres 17 into an S3-compatible bucket, both ✓ Backup complete; docker stop exits cleanly in under a second; valid/invalid schedule matrix.

Known limit, not handled: a calendar-impossible schedule such as 0 0 31 2 * passes validation and supercronic then logs warnings in a loop. Catching it needs a cron evaluator; out of scope here.

- Dockerfile builds the CLI from this repo's source on node 24 alpine, with
  pg_dump/pg_restore/psql 17 (same major as the GitHub Action), runs as the
  non-root node user, and has no credentials in it: config is env-only
- BACKUPDRILL_CRON runs `backupdrill backup` on that schedule via supercronic
  (TZ honoured, no overlapping runs); without it the container runs one
  backup and exits; arguments go straight to the CLI. An invalid schedule
  exits 64 at start
- workflow builds and smoke-tests the image on PRs, and on main pushes
  ghcr.io/backupdrill/backupdrill:latest, :<version>, :sha-<commit> for
  amd64 and arm64
- README: Docker section
@supertj
supertj merged commit 782dc13 into main Nov 4, 2026
1 check passed
@supertj
supertj deleted the feature/docker-image branch November 4, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant