Commit 9e184f38 authored by Matija Obreza's avatar Matija Obreza
Browse files

Build the pm2 config file on startup

parent 3b58c1a7
Pipeline #4103 passed with stages
in 3 minutes and 6 seconds
#
# Build Genesys Catalog UI server on top of node:alpine
#
FROM node:8.4-alpine
FROM node:alpine
LABEL maintainer "Matija Obreza <matija.obreza@croptrust.org>"
# Install gettext (for envsubst)
RUN apk add --no-cache gettext
# Instal npm dependencies and remove package.json
RUN npm install pm2 -g
# Entrypoint and template
COPY ssr.sh catalogui-pm2.yml /
ENV USER=nobody \
APP_PATH=/var/www/genesys-catalog-ui
COPY catalogui-pm2.yml ${APP_PATH}/
# Entrypoint
COPY ssr.sh /
# Application
COPY app ${APP_PATH}/
......
apps:
- script: 'server.js'
name: 'catalogui'
exec_mode: 'cluster'
- script: server.js
args: --api-url=${CATALOG_API_URL} --client-id=${CLIENT_ID} --client-secret=${CLIENT_SECRET}
name: catalogui
exec_mode: cluster
instances: 3
log_type: 'raw'
cwd: '/var/www/genesys-catalog-ui/server'
log_type: raw
cwd: /var/www/genesys-catalog-ui/server
env:
NODE_ENV: production
# Where to resolve modules from -- not used anymore
NODE_PATH: src
#!/bin/sh
echo "Running Genesys Catalog UI from `pwd` with CLIENT_ID=${CLIENT_ID} and API at ${CATALOG_API_URL}"
echo "Starting on TCP port ${PORT} (default 3000)."
exec pm2-docker start --auto-exit catalogui-pm2.yml --args "--api-url='${CATALOG_API_URL}' --client-id='${CLIENT_ID}' --client-secret='${CLIENT_SECRET}'"
envsubst < /catalogui-pm2.yml > catalogui-pm2.yml
exec pm2-docker start catalogui-pm2.yml
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment