thecatlady / docker-webhook Goto Github PK
View Code? Open in Web Editor NEWA lightweight, minimal webhook container ⚓
Home Page: https://hub.docker.com/r/thecatlady/webhook
License: MIT License
A lightweight, minimal webhook container ⚓
Home Page: https://hub.docker.com/r/thecatlady/webhook
License: MIT License
Please update the readme and add
version: "3"
How do you use this container?
After receiving a webhook, I want some action to occur, in my case I want to send an http request somewhere.
What language can I write some code do do an action after receiving the webhook?
I've tried building a go script in it, and it runs, except that when I include a net/http library it won't work.
Is the only option to use sh?
Or is this container supposed to be used for something else, like install python on it and then use a request library to make a request after receiving the webhook?
Thanks for the insight.
I have the webhook container running nicely along another container. I use docker compose to get them both running at the same time.
I would like to rebuild and restart the other container when the webhook is triggered.
Here is my script:
#!/usr/bin/env sh
GIT_REF=${1}
GIT_DIR=${2}
PUID=${3}
PGID=${4}
DOCKER_CONTAINER=${5}
USER=${6}
EMAIL=${7}
# log date
echo "[deploy] $(date):${6}(${7})"
# install git
if ! command -v git > /dev/null 2>&1; then
apk add --no-cache git
fi
# install openssh
if ! command -v ssh > /dev/null 2>&1; then
apk add --no-cache openssh
fi
if ! command -v docker > /dev/null 2>&1; then
apk add --no-cache docker
fi
if ! command -v docker-compose > /dev/null 2>&1; then
apk add --no-cache docker-compose
fi
git config --global --add safe.directory ${GIT_DIR}
git fetch --all
git checkout --force ${GIT_REF}
chown -R ${PUID}:${PGID} ${GIT_DIR}
docker-compose up --build ${DOCKER_CONTAINER} -d
#docker compose up --build ${DOCKER_CONTAINER} -d
I also added - /var/run/docker.sock:/var/run/docker.sock
to the volumes of the webhook container in the compose file. I googled around and apparently I need that.
But the webhook image, when triggered, and tries to execute the docker compose command, can't seem to find the docker-compose.yaml. Of course it can't because I didn't mount it.. but is it required? How can I go about this rebuild/restart situation? Any ideas?
When deploying my hooks.yml file, it cannot find the scripts I made for each of my deployments. Is this a known issue?
Hi, this is a nice image, i would love to use it instead of hard coding webhook directly on server's OS, BUT there is a problem you didn't mentioned in README and I suppose it makes the image at least not useful in many cases and at worst not useful at all for some situations.
This was discussed in more detail here for example:
https://stackoverflow.com/questions/32163955/how-to-run-shell-script-on-host-from-docker-container
Short: If you want to execute shell scripts from the inside of a container, you need to use hacks or even worse hacks (this is not designed this way, but the opposite), and after doing so, encounter problems like container restart, server restart which may (or may not) mess up things, in sense of messing those hacks. I didn't find yet any clean and STABLE solution to this problem (disclaimer: didn't spend much time trying), you probably don't want to run your scripts inside of the container with Webhook (which actually happens by reasonable default after using this image), but directly in OS, and this is different matter.
To sum up (it's late nigh here in PL :D, hope above text is understandable), if you are aware of any clean and stable solution, please share, cheers ;)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.