24 lines
945 B
YAML
24 lines
945 B
YAML
services:
|
|
nodejs-apps:
|
|
image: node:lts-slim
|
|
|
|
container_name: node-apps
|
|
ports:
|
|
- "3030:3000"
|
|
- "3031:3001"
|
|
- "3032:3002"
|
|
|
|
# Set the working directory inside the container
|
|
working_dir: /usr/src/app
|
|
volumes:
|
|
- ./nodejs_data:/usr/src/app
|
|
|
|
# The command to execute when the container starts.
|
|
# It performs the following sequence:
|
|
# 1. Installs PM2 globally.
|
|
# 2. Runs the main application dependencies installation (assuming you have a package.json).
|
|
# 3. Executes pm2-runtime, using the config file to launch all three apps
|
|
# (ag-home, ag-beats, ag-ball) and keeping the container running.
|
|
command: /bin/sh -c "npm install -g pm2 && cd ag-beats && npm install && cd ../ball-shooting && npm install && cd .. && pm2 start server.js --name ag-home && cd ag-beats && pm2 start ecosystem.config.js && cd ../ball-shooting && pm2 start npm --name ag-ball -- start && pm2 logs --raw"
|
|
restart: unless-stopped
|