#!/bin/sh
set -e

export NGINX_PORT="${NGINX_PORT:-80}"
export NODE_PORT="${PORT:-3000}"

envsubst '${NGINX_PORT} ${NODE_PORT}' \
  < /etc/nginx/nginx.conf.template \
  > /etc/nginx/nginx.conf

nginx -t
nginx

exec npm run start:prod
