Spaces:
Build error
Build error
Create start.sh
Browse files
start.sh
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Default values for PUID and PGID
|
| 4 |
+
PUID=${PUID:-1000}
|
| 5 |
+
PGID=${PGID:-1000}
|
| 6 |
+
|
| 7 |
+
echo "Using PUID=${PUID} and PGID=${PGID}"
|
| 8 |
+
|
| 9 |
+
# Modify the appuser and appgroup to match PUID and PGID
|
| 10 |
+
if [ "$(id -u appuser)" != "$PUID" ] || [ "$(id -g appuser)" != "$PGID" ]; then
|
| 11 |
+
echo "Updating UID and GID for appuser to match PUID:PGID..."
|
| 12 |
+
deluser appuser
|
| 13 |
+
addgroup -g "$PGID" appgroup
|
| 14 |
+
adduser -D -u "$PUID" -G appgroup appuser
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
# Ensure ownership of /config, /data and /temp are correct
|
| 18 |
+
chown -R appuser:appgroup /config /data /temp
|
| 19 |
+
|
| 20 |
+
# Start the application as appuser
|
| 21 |
+
exec su-exec appuser:appgroup gunicorn tubetube.tubetube:app -c srv.py
|