-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
46 lines (38 loc) Β· 1.29 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
46 lines (38 loc) Β· 1.29 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Docker entrypoint script for frontend with nginx
echo "π Starting Smart Doorbell Frontend with Nginx..."
date +"[%T] Bootstrap start"
# Inject runtime configuration
echo "π§ Injecting runtime configuration..."
date +"[%T] Running /inject-config.sh"
/inject-config.sh
date +"[%T] Finished inject-config.sh"
# Ensure nginx directories exist and have proper permissions
echo "π Setting up nginx directories..."
date +"[%T] Creating nginx temp dirs"
mkdir -p /var/cache/nginx/client_temp
mkdir -p /var/cache/nginx/proxy_temp
mkdir -p /var/cache/nginx/fastcgi_temp
mkdir -p /var/cache/nginx/uwsgi_temp
mkdir -p /var/cache/nginx/scgi_temp
# Set proper permissions for nginx
date +"[%T] Setting ownership"
chown -R nginx:nginx /var/cache/nginx
chown -R nginx:nginx /var/log/nginx
# Test nginx configuration
echo "π Testing nginx configuration..."
date +"[%T] Running nginx -t"
nginx -t
if [ $? -eq 0 ]; then
echo "β
Nginx configuration is valid"
else
echo "β Nginx configuration test failed"
exit 1
fi
date +"[%T] Starting nginx"
echo "π Starting nginx server..."
echo "π Frontend will be available on port 80"
echo "π Health check available at /health"
# Execute the command passed to the container (usually: nginx -g 'daemon off;')
date +"[%T] Exec passed command"
exec "$@"