Created
January 21, 2021 02:37
-
-
Save chrisjensen/186664f27814d850895c9935523ccf05 to your computer and use it in GitHub Desktop.
NGINX + Node launch file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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