Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oberonamsterdam/docker-pm2
https://github.com/oberonamsterdam/docker-pm2
dockerfile
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/oberonamsterdam/docker-pm2
- Owner: oberonamsterdam
- Created: 2018-04-30T21:39:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-26T11:10:33.000Z (about 3 years ago)
- Last Synced: 2024-11-20T21:42:24.439Z (3 months ago)
- Topics: dockerfile
- Language: Dockerfile
- Size: 3.91 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Based on https://hub.docker.com/r/keymetrics/pm2/
# 19-1-2020: Adding node-14 LTS support, PS5 released here but haven't been able to get one...
# 04-05-2020: Removing node-4 support due to build errors (node-gyp-build), adding node-12 LTS# Adding git to image
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:
* update code
* install dependancies
* compile code
* start pm2 app# Example docker-compose.yml
```
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"]
```# Example start.sh
```
#!/usr/bin/env shwhile [ ! -f /app/deployed.lock ]
do
sleep 2
donepm2-runtime /app/app.json
```
# Example deploy.sh
```
#!/usr/bin/env shecho "We're deploying..."
git pull
$(which npm) install --frozen-lockfile
$(which npm) run buildtouch deployed.lock
pm2 reload my-app
echo ""
echo "!!! Deploy finished !!!"```
This example will:
1. Start the container
2. The start.sh will loop untill the deployed.lock file is written
3. We execute the deploy.sh inside the container and write the deployed.lock file
4. The start.sh will continue and start pm2-runtimeOR:
1. Change the entrypoint to "pm2-runtime app/app/json" for immediate starting of the application and not wait for the build/deployment