I run a node server (in a Docker container) to listen for github webhooks, so I can redeploy when my master gets updated. My home directory contains:
production/
app/webhooks/
docker-compose-webhooks.yml
deploy.sh
~/docker-compose-webhooks.yml
version: '3'
services:
webhooks:
image: node:10.11.0-alpine
container_name: abis-webhooks
working_dir: /webhooks
environment:
NODE_ENV: production
PORT: 5050
GITHUB_SECRET: ${GITHUB_SECRET}
expose:
- '5050'
volumes:
- ./app/webhooks:/webhooks
command: /bin/sh -c 'npm install --production; npm start'
~/deploy.sh
#!/bin/bash
cd ~/production && git pull origin master
...
...
What's the easiest way I can call the deploy.sh that is obviously located outside the container where node sits.
I took this from another post and add it in node:
exec(`docker run --rm -v /usr/bin:/usr/bin --privileged -v $(pwd)/depoly.sh:~/deploy.sh ubuntu bash ~/deploy.sh`)