diff --git a/.editorconfig b/.editorconfig index aefda6f..5f150f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,6 @@ trim_trailing_whitespace = false indent_style = space indent_size = 2 -[{**.sh,root/etc/cont-init.d/**,root/etc/services.d/**,root/etc/s6-overlay/s6-rc.d/**}] +[{**.sh,root/etc/s6-overlay/s6-rc.d/**,root/etc/cont-init.d/**,root/etc/services.d/**}] indent_style = space indent_size = 4 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fd52afd..f2c1d06 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,10 +1,10 @@ -# Contributing to invoiceninja +# Contributing to webhook ## Gotchas * While contributing make sure to make all your changes before creating a Pull Request, as our pipeline builds each commit after the PR is open. * Read, and fill the Pull Request template - * If this is a fix for a typo in code or documentation in the README please file an issue + * If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR * If the PR is addressing an existing issue include, closes #\, in the body of the PR commit message * If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn) @@ -24,10 +24,10 @@ ## Readme If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit. -Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-invoiceninja/edit/master/readme-vars.yml). +Instead edit the [readme-vars.yml](https://github.com/linuxserver-labs/docker-webhook/edit/master/readme-vars.yml). These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play. -Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-invoiceninja) +Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-webhook) ### Fixing typos or clarify the text in the readme @@ -96,25 +96,26 @@ If you are proposing additional packages to be added, ensure that you added the ### Testing your changes -``` -git clone https://github.com/linuxserver/docker-invoiceninja.git -cd docker-invoiceninja +```bash +git clone https://github.com/linuxserver-labs/docker-webhook.git +cd docker-webhook docker build \ --no-cache \ --pull \ - -t linuxserver/invoiceninja:latest . + -t linuxserver-labs/webhook:latest . ``` -The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static` -``` -docker run --rm --privileged multiarch/qemu-user-static:register --reset +The ARM variants can be built on x86_64 hardware and vice versa using `lscr.io/linuxserver/qemu-static` + +```bash +docker run --rm --privileged lscr.io/linuxserver/qemu-static --reset ``` Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`. -## Update the chagelog +## Update the changelog -If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-invoiceninja/tree/master/root), add an entry to the changelog +If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver-labs/docker-webhook/tree/main/root), add an entry to the changelog ```yml changelogs: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 73ff0cc..db11e11 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -7,7 +7,3 @@ contact_links: - name: Discourse discussion forum url: https://discourse.linuxserver.io about: Post on our community forum. - - - name: Documentation - url: https://docs.linuxserver.io/images/docker-invoiceninja - about: Documentation - information about all of our containers. diff --git a/.github/ISSUE_TEMPLATE/issue.bug.md b/.github/ISSUE_TEMPLATE/issue.bug.md deleted file mode 100644 index e1b97f4..0000000 --- a/.github/ISSUE_TEMPLATE/issue.bug.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- -[linuxserverurl]: https://linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] - - - - - ------------------------------- - -## Expected Behavior - - -## Current Behavior - - -## Steps to Reproduce - - -1. -2. -3. -4. - -## Environment -**OS:** -**CPU architecture:** x86_64/arm32/arm64 -**How docker service was installed:** - - - -## Command used to create docker container (run/create/compose/screenshot) - - -## Docker logs - diff --git a/.github/ISSUE_TEMPLATE/issue.bug.yml b/.github/ISSUE_TEMPLATE/issue.bug.yml new file mode 100644 index 0000000..12711b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.bug.yml @@ -0,0 +1,76 @@ +# Based on the issue template +name: Bug report +description: Create a report to help us improve +title: "[BUG] " +labels: [Bug] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Current Behavior + description: Tell us what happens instead of the expected behavior. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: Tell us what should happen. + validations: + required: false + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run '...' + 4. See error... + validations: + required: true + - type: textarea + attributes: + label: Environment + description: | + examples: + - **OS**: Ubuntu 20.04 + - **How docker service was installed**: distro's packagemanager + value: | + - OS: + - How docker service was installed: + render: markdown + validations: + required: false + - type: dropdown + attributes: + label: CPU architecture + options: + - x86-64 + - arm64 + validations: + required: true + - type: textarea + attributes: + label: Docker creation + description: | + Command used to create docker container + Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container + render: bash + validations: + required: true + - type: textarea + attributes: + description: | + Provide a full docker log, output of "docker logs webhook" + label: Container logs + placeholder: | + Output of `docker logs webhook` + render: bash + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/issue.feature.md b/.github/ISSUE_TEMPLATE/issue.feature.md deleted file mode 100644 index 20a91fd..0000000 --- a/.github/ISSUE_TEMPLATE/issue.feature.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- -[linuxserverurl]: https://linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] - -<!--- If you are new to Docker or this application our issue tracker is **ONLY** used for reporting bugs or requesting features. Please use [our discord server](https://discord.gg/YWrKVTn) for general support. ---> - -<!--- If this acts as a feature request please ask yourself if this modification is something the whole userbase will benefit from ---> -<!--- If this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ --> - -<!--- Provide a general summary of the request in the Title above --> - ------------------------------- - -## Desired Behavior -<!--- Tell us what should happen --> - -## Current Behavior -<!--- Tell us what happens instead of the expected behavior --> - -## Alternatives Considered -<!--- Tell us what other options you have tried or considered --> diff --git a/.github/ISSUE_TEMPLATE/issue.feature.yml b/.github/ISSUE_TEMPLATE/issue.feature.yml new file mode 100644 index 0000000..099dcdb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.feature.yml @@ -0,0 +1,31 @@ +# Based on the issue template +name: Feature request +description: Suggest an idea for this project +title: "[FEAT] <title>" +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Is this a new feature request? + description: Please search to see if a feature request already exists. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Wanted change + description: Tell us what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Reason for change + description: Justify your request, why do you want it, what is the benefit. + validations: + required: true + - type: textarea + attributes: + label: Proposed code change + description: Do you have a potential code change in mind? + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c2f46bf..9a895a3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,12 @@ <!--- Provide a general summary of your changes in the Title above --> [linuxserverurl]: https://linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/lsio-labs-wide.png)][linuxserverurl] +[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] <!--- Before submitting a pull request please check the following --> -<!--- If this is a fix for a typo in code or documentation in the README please file an issue and let us sort it out we do not need a PR --> +<!--- If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR --> <!--- Ask yourself if this modification is something the whole userbase will benefit from, if this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ --> <!--- That if the PR is addressing an existing issue include, closes #<issue number> , in the body of the PR commit message --> <!--- You have included links to any files / patches etc your PR may be using in the body of the PR commit message --> @@ -21,7 +21,7 @@ ------------------------------ - - [ ] I have read the [contributing](https://github.com/linuxserver/docker-invoiceninja/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications + - [ ] I have read the [contributing](https://github.com/linuxserver-labs/docker-webhook/blob/main/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications ------------------------------ diff --git a/.github/workflows/call-baseimage-update.yml b/.github/workflows/call-baseimage-update.yml index 4f7fde3..0e8d6e2 100644 --- a/.github/workflows/call-baseimage-update.yml +++ b/.github/workflows/call-baseimage-update.yml @@ -11,7 +11,7 @@ jobs: with: repo_owner: ${{ github.repository_owner }} baseimage: "alpine" - basebranch: "3.18" + basebranch: "3.21" app_name: "webhook" secrets: repo_release_token: ${{ secrets.repo_release_token }} diff --git a/.github/workflows/call-build-image.yml b/.github/workflows/call-build-image.yml index 818410a..556431b 100644 --- a/.github/workflows/call-build-image.yml +++ b/.github/workflows/call-build-image.yml @@ -13,6 +13,6 @@ jobs: app_name: "webhook" release_type: "github" release_url: "https://api.github.com/repos/adnanh/webhook" - target-arch: "64" + target-arch: "all" secrets: OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml index 1447bc5..02e1bdb 100644 --- a/.github/workflows/permissions.yml +++ b/.github/workflows/permissions.yml @@ -5,6 +5,8 @@ on: - '**/run' - '**/finish' - '**/check' + - 'root/migrations/*' + jobs: permission_check: uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1 diff --git a/Dockerfile b/Dockerfile index e3be5a3..2a94584 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as buildstage +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:3.21 AS buildstage # build variables ARG APP_VERSION @@ -28,7 +30,7 @@ RUN \ go get -d && \ go build -o /app/webhook -FROM ghcr.io/linuxserver/baseimage-alpine:3.18 +FROM ghcr.io/linuxserver/baseimage-alpine:3.21 ARG BUILD_DATE ARG VERSION @@ -39,4 +41,4 @@ LABEL maintainer="Roxedus" # copy files from build stage and local files COPY --from=buildstage /app/webhook /app/webhook -COPY root/ / \ No newline at end of file +COPY root/ / diff --git a/README.md b/README.md index 49d8c83..f9b9385 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ -<!-- DO NOT EDIT THIS FILE MANUALLY --> -<!-- Please read the https://github.com/linuxserver/docker-webhook/blob/main/.github/CONTRIBUTING.md --> - -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/lsio-labs-wide.png)](https://linuxserver.io) +<!-- DO NOT EDIT THIS FILE MANUALLY --> +<!-- Please read https://github.com/linuxserver-labs/docker-webhook/blob/main/.github/CONTRIBUTING.md --> +[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io) [![Blog](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Blog)](https://blog.linuxserver.io "all the things you can do with our containers including How-To guides, opinions and much more!") [![Discord](https://img.shields.io/discord/354974912613449730.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Discord&logo=discord)](https://discord.gg/YWrKVTn "realtime support / chat with the community and the team.") [![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=discourse)](https://discourse.linuxserver.io "post on our community forum.") [![Fleet](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.") -[![GitHub](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub&logo=github)](https://github.com/linuxserver "view the source for all of our repositories.") +[![GitHub](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub&logo=github)](https://github.com/linuxserver-labs "view the source for all of our repositories.") [![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Supporters&logo=open%20collective)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget") > ## **_WARNING:_** Linuxserver Labs images are *not* production ready and we do not provide support for them. They are experimental and could change/break at any time. Please do not deploy them anywhere important @@ -26,61 +25,67 @@ Find us at: * [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team. * [Discourse](https://discourse.linuxserver.io) - post on our community forum. * [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images. -* [GitHub](https://github.com/linuxserver) - view the source for all of our repositories. +* [GitHub](https://github.com/linuxserver-labs) - view the source for all of our repositories. * [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget # [linuxserver-labs/webhook](https://github.com/linuxserver-labs/docker-webhook) -[![Scarf.io pulls](https://scarf.sh/installs-badge/linuxserver-ci/linuxserver-labs%2Fwebhook?color=94398d&label-color=555555&logo-color=ffffff&style=for-the-badge&package-type=docker)](https://scarf.sh/gateway/linuxserver-ci/docker/linuxserver-labs%2Fwebhook) [![GitHub Stars](https://img.shields.io/github/stars/linuxserver-labs/docker-webhook.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/linuxserver-labs/docker-webhook) [![GitHub Release](https://img.shields.io/github/release/linuxserver-labs/docker-webhook.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/linuxserver-labs/docker-webhook/releases) [![GitHub Package Repository](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub%20Package&logo=github)](https://github.com/linuxserver-labs/docker-webhook/packages) -[![ci](https://img.shields.io/github/workflow/status/linuxserver-labs/docker-webhook/Check%20for%20update%20and%20release.svg?labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Upstream%20Updates)](https://github.com/linuxserver-labs/docker-webhook/actions/workflows/call-chck-and-release.yml) -[![ci](https://img.shields.io/github/workflow/status/linuxserver-labs/docker-webhook/Check%20for%20base%20image%20updates.svg?labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Baseimage%20Updates)](https://github.com/linuxserver-labs/docker-webhook/actions/workflows/call-baseimage-update.yml) -[![ci](https://img.shields.io/github/workflow/status/linuxserver-labs/docker-webhook/Build%20Image%20On%20Release.svg?labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Build%20Image)](https://github.com/linuxserver-labs/docker-webhook/actions/workflows/call-build-image.yml) -[webhook](https://github.com/adnanh/webhook) is a lightweight configurable tool written in Go, that allows you to easily create HTTP endpoints (hooks) on your server, which you can use to execute configured commands. You can also pass data from the HTTP request (such as headers, payload or query variables) to your commands. webhook also allows you to specify rules which have to be satisfied in order for the hook to be triggered. +[Webhook](https://github.com/adnanh/webhook) is a lightweight configurable tool written in Go, that allows you to easily create HTTP endpoints (hooks) on your server, which you can use to execute configured commands. You can also pass data from the HTTP request (such as headers, payload or query variables) to your commands. webhook also allows you to specify rules which have to be satisfied in order for the hook to be triggered. [![webhook](https://raw.githubusercontent.com/adnanh/webhook/development/docs/logo/logo-128x128.png)](https://github.com/adnanh/webhook) ## Supported Architectures -Our images support multiple architectures such as `x86-64`, `arm64` and `armhf`. We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#manifest-list) and our announcement [here](https://blog.linuxserver.io/2019/02/21/the-lsio-pipeline-project/). +We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://distribution.github.io/distribution/spec/manifest-v2-2/#manifest-list) and our announcement [here](https://blog.linuxserver.io/2019/02/21/the-lsio-pipeline-project/). -Simply pulling `ghcr.io/linuxserver-labs/webhook` should retrieve the correct image for your arch, but you can also pull specific arch images via tags. +Simply pulling `ghcr.io/linuxserver-labs/webhook:latest` should retrieve the correct image for your arch, but you can also pull specific arch images via tags. The architectures supported by this image are: -| Architecture | Tag | -| :----------: | -------------- | -| x86-64 | latest | -| arm64 | arm64v8-latest | -| armhf | arm32v7-latest | +| Architecture | Available | Tag | +| :----: | :----: | ---- | +| x86-64 | ✅ | amd64-\<version tag\> | +| arm64 | ✅ | arm64v8-\<version tag\> | +| armhf | ❌ | | ## Application Setup This image looks at the json file `/config/hooks/hooks.json` for configuring webhooks. Configuration instructions can be found [upstream](https://github.com/adnanh/webhook#configuration). +## Read-Only Operation + +This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/). + +## Non-Root Operation + +This image can be run with a non-root user. For details please [read the docs](https://docs.linuxserver.io/misc/non-root/). + ## Usage -Here are some example snippets to help you get started creating a container. +To help you get started creating a container from this image you can either use docker-compose or the docker cli. + +>[!NOTE] +>Unless a parameter is flaged as 'optional', it is *mandatory* and a value must be provided. ### docker-compose (recommended, [click here for more info](https://docs.linuxserver.io/general/docker-compose)) ```yaml --- -version: "2.1" services: webhook: - image: ghcr.io/linuxserver-labs/webhook + image: ghcr.io/linuxserver-labs/webhook:latest container_name: webhook environment: - PUID=1000 - PGID=1000 - - TZ=Europe/Oslo - - EXTRA_PARAM= #optional + - TZ=Etc/UTC + - EXTRA_PARAM=-hotreload #optional volumes: - - /path/to/config:/config + - /path/to/webhook/data:/config ports: - 9000:9000 restart: unless-stopped @@ -93,26 +98,28 @@ docker run -d \ --name=webhook \ -e PUID=1000 \ -e PGID=1000 \ - -e TZ=Europe/Oslo \ - -e EXTRA_PARAM= `#optional` \ + -e TZ=Etc/UTC \ + -e EXTRA_PARAM=-hotreload `#optional` \ -p 9000:9000 \ - -v /path/to/config:/config \ + -v /path/to/webhook/data:/config \ --restart unless-stopped \ - ghcr.io/linuxserver-labs/webhook + ghcr.io/linuxserver-labs/webhook:latest ``` ## Parameters -Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container. +Containers are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container. -| Parameter | Function | -| :-----------------: | -------------------------------------------------------------------------------------------------------------------------------- | -| `-p 9000` | Endpoint for receival of webhooks | -| `-e PUID=1000` | for UserID - see below for explanation | -| `-e PGID=1000` | for GroupID - see below for explanation | -| `-e TZ=Europe/Oslo` | Specify a timezone to use e.g. Europe/London. | -| `-e EXTRA_PARAM=` | Additional [CLI arguments](https://github.com/adnanh/webhook/blob/master/docs/Webhook-Parameters.md) to pass to the application. | -| `-v /config` | Stores config and application files | +| Parameter | Function | +| :----: | --- | +| `-p 9000:9000` | Endpoint for webhooks | +| `-e PUID=1000` | for UserID - see below for explanation | +| `-e PGID=1000` | for GroupID - see below for explanation | +| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | +| `-e EXTRA_PARAM=-hotreload` | Extra parameters to send to the webhook binary. | +| `-v /config` | Hooks and potential custom scripts | +| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). | +| `--user=1000:1000` | Run container with a non-root user. Please [read the docs](https://docs.linuxserver.io/misc/non-root/). | ## Environment variables from files (Docker secrets) @@ -121,10 +128,10 @@ You can set any environment variable from a file by using a special prepend `FIL As an example: ```bash --e FILE__PASSWORD=/run/secrets/mysecretpassword +-e FILE__MYVAR=/run/secrets/mysecretvariable ``` -Will set the environment variable `PASSWORD` based on the contents of the `/run/secrets/mysecretpassword` file. +Will set the environment variable `MYVAR` based on the contents of the `/run/secrets/mysecretvariable` file. ## Umask for running applications @@ -133,15 +140,20 @@ Keep in mind umask is not chmod it subtracts from permissions based on it's valu ## User / Group Identifiers -When using volumes (`-v` flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`. +When using volumes (`-v` flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`. Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic. -In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below: +In this instance `PUID=1000` and `PGID=1000`, to find yours use `id your_user` as below: ```bash - $ id username - uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup) +id your_user +``` + +Example output: + +```text +uid=1000(your_user) gid=1000(your_user) groups=1000(your_user) ``` ## Docker Mods @@ -152,53 +164,101 @@ We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to ## Support Info -* Shell access whilst the container is running: `docker exec -it webhook /bin/bash` -* To webhookor the logs of the container in realtime: `docker logs -f webhook` -* container version number - * `docker inspect -f '{{ index .Config.Labels "build_version" }}' webhook` -* image version number - * `docker inspect -f '{{ index .Config.Labels "build_version" }}' ghcr.io/linuxserver-labs/webhook` +* Shell access whilst the container is running: + + ```bash + docker exec -it webhook /bin/bash + ``` + +* To monitor the logs of the container in realtime: + + ```bash + docker logs -f webhook + ``` + +* Container version number: + + ```bash + docker inspect -f '{{ index .Config.Labels "build_version" }}' webhook + ``` + +* Image version number: + + ```bash + docker inspect -f '{{ index .Config.Labels "build_version" }}' ghcr.io/linuxserver-labs/webhook:latest + ``` ## Updating Info -Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (ie. nextcloud, plex), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image. +Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image. Below are the instructions for updating containers: ### Via Docker Compose -* Update all images: `docker-compose pull` - * or update a single image: `docker-compose pull webhook` -* Let compose update all containers as necessary: `docker-compose up -d` - * or update a single container: `docker-compose up -d webhook` -* You can also remove the old dangling images: `docker image prune` +* Update images: + * All images: + + ```bash + docker-compose pull + ``` + + * Single image: + + ```bash + docker-compose pull webhook + ``` + +* Update containers: + * All containers: + + ```bash + docker-compose up -d + ``` + + * Single container: + + ```bash + docker-compose up -d webhook + ``` + +* You can also remove the old dangling images: + + ```bash + docker image prune + ``` ### Via Docker Run -* Update the image: `docker pull ghcr.io/linuxserver-labs/webhook` -* Stop the running container: `docker stop webhook` -* Delete the container: `docker rm webhook` -* Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved) -* You can also remove the old dangling images: `docker image prune` +* Update the image: -### Via Watchtower auto-updater (only use if you don't remember the original parameters) + ```bash + docker pull ghcr.io/linuxserver-labs/webhook:latest + ``` -* Pull the latest image at its tag and replace it with the same env variables in one run: +* Stop the running container: - ```bash - docker run --rm \ - -v /var/run/docker.sock:/var/run/docker.sock \ - containrrr/watchtower \ - --run-once webhook - ``` + ```bash + docker stop webhook + ``` -* You can also remove the old dangling images: `docker image prune` +* Delete the container: + + ```bash + docker rm webhook + ``` + +* Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved) +* You can also remove the old dangling images: -**Note:** We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using [Docker Compose](https://docs.linuxserver.io/general/docker-compose). + ```bash + docker image prune + ``` ### Image Update Notifications - Diun (Docker Image Update Notifier) -* We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported. +>[!TIP] +>We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported. ## Building locally @@ -213,15 +273,16 @@ docker build \ -t ghcr.io/linuxserver-labs/webhook:latest . ``` -The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static` +The ARM variants can be built on x86_64 hardware and vice versa using `lscr.io/linuxserver/qemu-static` ```bash -docker run --rm --privileged multiarch/qemu-user-static:register --reset +docker run --rm --privileged lscr.io/linuxserver/qemu-static --reset ``` Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`. ## Versions -* **21.09.23:** - Rebase to alpine 3.18, deprecate arm32v7 (armhf) per [this notice](https://info.linuxserver.io/issues/2023-05-06-armhf/). -* **14.01.22:** - Initial release. +* **06.01.25:** - Rebase to Alpine 3.21. +* **21.09.23:** - Rebase to alpine 3.18. +* **14.01.22:** - Initial Release. diff --git a/docker-bake.hcl b/docker-bake.hcl index 5400ab8..1f17911 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -23,7 +23,7 @@ target "amd64" { target "arm64v8" { inherits = ["image"] - dockerfile = "Dockerfile.aarch64" + dockerfile = "Dockerfile" platforms = [ "linux/arm64" ] diff --git a/readme-vars.yml b/readme-vars.yml new file mode 100644 index 0000000..278a8d7 --- /dev/null +++ b/readme-vars.yml @@ -0,0 +1,40 @@ +--- + +# project information +project_name: webhook +project_url: "https://github.com/adnanh/webhook" +project_logo: "https://raw.githubusercontent.com/adnanh/webhook/development/docs/logo/logo-128x128.png" +project_blurb: | + [{{ project_name|capitalize }}]({{ project_url }}) is a lightweight configurable tool written in Go, that allows you to easily create HTTP endpoints (hooks) on your server, which you can use to execute configured commands. You can also pass data from the HTTP request (such as headers, payload or query variables) to your commands. webhook also allows you to specify rules which have to be satisfied in order for the hook to be triggered. +project_lsio_github_repo_url: "https://github.com/linuxserver-labs/docker-{{ project_name }}" +lsio_project_name_short: "linuxserver-labs" +# supported architectures +available_architectures: + - {arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} + - {arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} +# development version +development_versions: false +# optional container parameters +opt_param_usage_include_env: true +opt_param_env_vars: + - {env_var: "EXTRA_PARAM", env_value: "-hotreload", desc: "Extra parameters to send to the webhook binary."} +# container parameters +param_container_name: "{{ project_name }}" +param_usage_include_vols: true +param_volumes: + - {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/data", desc: "Hooks and potential custom scripts"} +opt_param_usage_include_vols: false +param_usage_include_ports: true +param_ports: + - {external_port: "9000", internal_port: "9000", port_desc: "Endpoint for webhooks"} +readonly_supported: true +nonroot_supported: true +# application setup block +app_setup_block_enabled: true +app_setup_block: | + This image looks at the json file `/config/hooks/hooks.json` for configuring webhooks. Configuration instructions can be found [upstream](https://github.com/adnanh/webhook#configuration). +# changelog +changelogs: + - {date: "06.01.25:", desc: "Rebase to Alpine 3.21."} + - {date: "21.09.23:", desc: "Rebase to alpine 3.18."} + - {date: "14.01.22:", desc: "Initial Release."} diff --git a/root/etc/s6-overlay/s6-rc.d/init-webhook/run b/root/etc/s6-overlay/s6-rc.d/init-webhook/run index 4adabde..dce4fa4 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-webhook/run +++ b/root/etc/s6-overlay/s6-rc.d/init-webhook/run @@ -8,5 +8,7 @@ if [ ! -f "/config/hooks/hooks.json" ]; then cp /defaults/hooks.json /config/hooks/hooks.json fi -lsiown -R abc:abc \ - /config +if [[ -z ${LSIO_NON_ROOT_USER} ]]; then + lsiown -R abc:abc \ + /config +fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-webhook/run b/root/etc/s6-overlay/s6-rc.d/svc-webhook/run index 485dbc1..7987a35 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-webhook/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-webhook/run @@ -1,8 +1,14 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -# shellcheck disable=SC2086 -exec \ - s6-setuidgid abc /app/webhook \ - -hooks /config/hooks/hooks.json \ - -ip 0.0.0.0 ${EXTRA_PARAM:=-hotreload} +if [[ -z ${LSIO_NON_ROOT_USER} ]]; then + exec \ + s6-setuidgid abc /app/webhook \ + -hooks /config/hooks/hooks.json \ + -ip 0.0.0.0 ${EXTRA_PARAM:=-hotreload} +else + exec \ + /app/webhook \ + -hooks /config/hooks/hooks.json \ + -ip 0.0.0.0 ${EXTRA_PARAM:=-hotreload} +fi