oberonamsterdam/pm2-git
Keymetrics/PM2 with git+ssh support
500K+
Based on https://hub.docker.com/r/keymetrics/pm2/
Since we run the source inside out PM2 containers, we need git+ssh to update inside the container. Mount your own .ssh/id_rsa file so the container can use your own server/workstation credentials.
Inside the start.sh you can like, do the following things:
version: '3'
services:
node:
image: oberonamsterdam/pm2-git:8-alpine
restart: always
network_mode: "bridge"
volumes:
- .:/app/:delegated
- $HOME/.ssh/known_hosts:/root/.ssh/known_hosts
- $HOME/.ssh/id_rsa:/root/.ssh/id_rsa
entrypoint: ["/app/start.sh"]
#!/usr/bin/env sh
while [ ! -f /app/deployed.lock ]
do
sleep 2
done
pm2-runtime /app/app.json
#!/usr/bin/env sh
echo "We're deploying..."
git pull
$(which npm) install --frozen-lockfile
$(which npm) run build
touch deployed.lock
pm2 reload my-app
echo ""
echo "!!! Deploy finished !!!"
This example will:
OR:
docker pull oberonamsterdam/pm2-git