forked from alam00000/bentopdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
42 lines (33 loc) · 1.26 KB
/
entrypoint.sh
File metadata and controls
42 lines (33 loc) · 1.26 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
#!/bin/sh
set -e
PUID=${PUID:-1000}
PGID=${PGID:-1000}
# Validate PUID/PGID
case "$PUID" in
''|*[!0-9]*) echo "ERROR: PUID must be a number, got '$PUID'" >&2; exit 1 ;;
esac
case "$PGID" in
''|*[!0-9]*) echo "ERROR: PGID must be a number, got '$PGID'" >&2; exit 1 ;;
esac
if [ "$PUID" -eq 0 ] || [ "$PGID" -eq 0 ]; then
echo "ERROR: PUID/PGID cannot be 0 (root). Use the standard Dockerfile instead." >&2
exit 1
fi
echo "Starting BentoPDF with PUID=$PUID PGID=$PGID"
addgroup -g "$PGID" bentopdf 2>/dev/null || true
adduser -u "$PUID" -G bentopdf -D -H -s /sbin/nologin bentopdf 2>/dev/null || true
rm -f /var/log/nginx/error.log /var/log/nginx/access.log
touch /var/log/nginx/error.log /var/log/nginx/access.log
chown "$PUID:$PGID" /var/log/nginx /var/log/nginx/error.log /var/log/nginx/access.log
sed -i '1i error_log stderr warn;' /etc/nginx/nginx.conf
sed -i '/^http {/a\ access_log /var/log/nginx/access.log;' /etc/nginx/nginx.conf
chown -R "$PUID:$PGID" \
/etc/nginx/tmp \
/var/cache/nginx \
/usr/share/nginx/html \
/etc/nginx/nginx.conf
if [ "$DISABLE_IPV6" = "true" ]; then
echo "Disabling Nginx IPv6 listener"
sed -i '/^[[:space:]]*listen[[:space:]]*\[::\]:[0-9]*/s/^/#/' /etc/nginx/nginx.conf
fi
exec su-exec "$PUID:$PGID" "$@"