-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·25 lines (19 loc) · 943 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·25 lines (19 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
set -e
# Health check logic (uses variables from .env)
API_URL=$(echo "${API_URL}" | sed 's|/$||g')
HEALTH_CHECK_URL=$(echo "${HEALTH_CHECK_URL}" | sed 's|/$||g')
echo "Performing health check on: ${HEALTH_CHECK_URL}"
if ! curl --fail -s ${HEALTH_CHECK_URL}; then
echo "--------------------------------------------------"
echo "ERROR: Backend health check failed on: ${HEALTH_CHECK_URL}"
echo "Please check API_URL and HEALTH_CHECK_PATH in your .env file."
echo "Hint: For local development, use http://host.docker.internal instead of http://localhost."
echo "--------------------------------------------------"
exit 1
fi
echo "Health check successful. Starting Nginx."
# Substitute all environment variables starting with NGINX_ in the template.
envsubst '${API_URL}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
# Start Nginx in the foreground.
nginx -g 'daemon off;'