{"id":19075866,"url":"https://github.com/lucarickli/ghcr-hook","last_synced_at":"2025-09-07T17:32:15.175Z","repository":{"id":163040458,"uuid":"637499448","full_name":"LucaRickli/GHCR-Hook","owner":"LucaRickli","description":"Keep your Docker images \u0026 containers in sync with GitHub's Container Registry using webhooks.","archived":false,"fork":false,"pushed_at":"2024-08-30T21:53:56.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T01:56:10.521Z","etag":null,"topics":["ci-cd","cicd","docker","docker-ci","ghcr","webhook"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucaRickli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-07T18:34:46.000Z","updated_at":"2024-08-30T21:53:53.000Z","dependencies_parsed_at":"2023-12-16T08:41:14.946Z","dependency_job_id":"f961bfa1-2d4f-47fd-9514-6862e85de6a4","html_url":"https://github.com/LucaRickli/GHCR-Hook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickli%2FGHCR-Hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickli%2FGHCR-Hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickli%2FGHCR-Hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickli%2FGHCR-Hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucaRickli","download_url":"https://codeload.github.com/LucaRickli/GHCR-Hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232235525,"owners_count":18492778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","cicd","docker","docker-ci","ghcr","webhook"],"created_at":"2024-11-09T01:56:16.104Z","updated_at":"2025-01-02T18:17:55.566Z","avatar_url":"https://github.com/LucaRickli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GHCR-Hook\n\n![workflow](https://img.shields.io/github/actions/workflow/status/lucarickli/ghcr-hook/build.yml)\n\n#### Keep your local Docker images \u0026 containers in sync with GitHub's Container Registry using webhooks.\n\nThe server reacts to webhooks from GitHub with the event `package.published`. If everything checks out it proceeds to download the new image \u0026 restart every container with the same configuration it was started except for the new image.\n\n### Limitations\n\n- There has to be at least one Container running using the image to be reloaded.\n- Currently does not support versioned images. E.g. upgrade from 1.1 to 1.2 wont work.\n- If something goes wrong there is no recovery!\n\n## Usage\n\n### Configuration\n\n#### Required\n\n- WEBHOOK_SECRET (or WEBHOOK_SECRET_FILE)\n\n\u003e For full configuration \u0026 defaults see: [`src/utils/config.ts`](https://github.com/LucaRickli/GHCR-Hook/blob/main/src/utils/config.ts)\n\n### Run with Docker\n\nCreate webhook secret.\n\n```bash\necho $(openssl rand -base64 32 | tr -d '\\n') \u003e webhook.secret\n```\n\nCreate `docker-compose.yml`.\n\n```yml\nversion: '3.8'\n\nsecrets:\n  webhook:\n    file: ./webhook.secret\n\nservices:\n  webhooks:\n    image: ghcr.io/lucarickli/ghcr-hook\n    secrets:\n      - webhook\n    environment:\n      WEBHOOK_SECRET_FILE: /run/secrets/webhook\n      # Can also be set without docker secret.\n      # WEBHOOK_SECRET: ${WEBHOOK_SECRET:?WEBHOOK_SECRET is required!}\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock\n      - ./logs:/home/logs\n    ports:\n      - 8000:8000\n```\n\nStart container.\n\n```bash\ndocker compose up\n```\n\n### Run locally\n\n```bash\ncp example.env .env\n```\n\n\u003e Edit `WEBHOOK_SECRET` inside `.env` to prevent attackers from accessing this endpoint!\n\n```bash\nnpm i\nnpm run build\nnpm start\n```\n\n#### Development\n\n```bash\nnpm run dev\nnpm run dev:debug # With debugging\n```\n\n## Add container to sync\n\n1. Pull the docker image you want to sync to your server.\n2. Start at least one container using this image.\n3. Add a webhook to your GitHub repo.\n   - Set `Payload Url` to your server.\n   - Set `Webhook Secret` to your generated secret.\n   - Set `Content type` to `applications/json`.\n   - Select `individual events` and remove everything except `packages`.\n\n## Todo's\n\n- Add version control with downgrade protection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucarickli%2Fghcr-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucarickli%2Fghcr-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucarickli%2Fghcr-hook/lists"}