Docker image for easily create a backup of all Github repositories associated to your user
  • TypeScript 90.1%
  • Dockerfile 8.9%
  • Shell 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2021-12-18 18:51:18 +01:00
.github/workflows Update docker.yml 2021-07-23 11:03:31 +02:00
src Fixed file permissions 2021-12-18 18:51:18 +01:00
.dockerignore Added EXCLUDE and INCLUDE options 2021-12-09 11:52:28 +01:00
.gitignore Added EXCLUDE and INCLUDE options 2021-12-09 11:52:28 +01:00
.yarnrc.yml Added EXCLUDE and INCLUDE options 2021-12-09 11:52:28 +01:00
Dockerfile Fixed file permissions 2021-12-18 18:51:18 +01:00
entry.sh Sceduled mode 2021-12-18 13:47:57 +01:00
package.json Sceduled mode 2021-12-18 13:47:57 +01:00
README.md Fixed file permissions 2021-12-18 18:51:18 +01:00
tsconfig.json init 2021-07-22 23:31:11 +02:00
yarn.lock Sceduled mode 2021-12-18 13:47:57 +01:00

Simple GitHub Backup

A simple GitHub backup image, which will fetch a mirror backup of all repos the user is associated with from GitHub

Usage

docker run -it --rm \
  -e GITHUB_TOKEN="$GH_TOKEN" \
  -v "$PWD/backup:/backup" \
  --cap-drop=all \
  --user "$UID:$GID" \
  ghcr.io/morten-olsen/github-backup run

Note: --user is not required, but recommended instead of running as root. Remember to give the user write access to the backup directory

You can also limit which repositories to back up using the environment variables INCLUDE and EXCLUDE, which supports a list or repos separated by , and with * as wildcard

-e INCLUDE="morten-olsen/*,morten-olsen-env/dotfiles" -e EXCLUDE="morten-olsen/something,*/test"

Backup structure

|-{user1}
|  |-{repo1}
|  |  |-info.json
|  |  |-git
|  |  |  |-...
|  |-{repo2}
|  |  |-info.json
|  |  |-git
|  |  |  |-...
|-{user2}
|  |-{repo1}
|  |  |-info.json
|  |  |-git
|  |  |  |-...

Scheduled

If the container is started without a command it will run in scheduled mode. It will run every Sunday at 3 am. This can be overridden using -e SCHEDULE="0 0 4 * * *" (Runs at 4 am every day) using the cron time format