Skip to content

Instantly share code, notes, and snippets.

@chrisjensen
Created January 21, 2021 02:37
Show Gist options
  • Save chrisjensen/186664f27814d850895c9935523ccf05 to your computer and use it in GitHub Desktop.
Save chrisjensen/186664f27814d850895c9935523ccf05 to your computer and use it in GitHub Desktop.
NGINX + Node launch file
#!/usr/bin/env bash
set -e
# Merge environment variable
envsubst '${RESOLVER}' < /home/app/nginx.conf > /home/app/nginx-complete.conf
# Launch nginx and node concurrently
nginx -g 'daemon off;' -c /home/app/nginx-complete.conf &
if [ "$NODE_ENV" = "development" ]; then
echo "Starting dev edge server ..."
env PORT=8081 npm run dev &
else
echo "Starting production edge server ..."
env PORT=8081 npm start &
fi
# This waits for either process to terminate
# causing the container to terminate so we fail fast
wait -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment