From f89e392ccfa674ed5c25b003644592c661152159 Mon Sep 17 00:00:00 2001 From: Nice Try Date: Fri, 26 Jun 2026 16:34:53 +0800 Subject: [PATCH] test --- docker-entrypoint.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c8229ab..5375ed1 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -4,17 +4,22 @@ set -e # Ensure bind-mounted runtime folders exist. mkdir -p /app/My_Courses /app/prisma -# If the container starts as root, make common bind mounts writable by the app user. -# This helps when users create ./prisma/dev.db or ./My_Courses on the host first. +# If the container starts as root, fix permissions. if [ "$(id -u)" = "0" ]; then - chown -R nextjs:nodejs /app/My_Courses /app/prisma 2>/dev/null || true + # For the database, we MUST own it to write to it. This folder is small, so -R is safe. + chown -R nextjs:nodejs /app/prisma 2>/dev/null || true + + # For the courses, we just need to make sure the nextjs user can READ and TRAVERSE it. + # We avoid chown -R here because doing it on 500GB of videos takes forever on boot. + chmod -R 755 /app/My_Courses 2>/dev/null || true fi -# A fresh Docker deployment often bind-mounts an empty SQLite file at /app/prisma/dev.db. +# A fresh Docker deployment often bind-mounts an empty SQLite file. # Initialize/update the Prisma schema before the Next.js server starts. if [ -n "${DATABASE_URL:-}" ]; then echo "Initializing SQLite schema with Prisma..." gosu nextjs:nodejs ./node_modules/.bin/prisma db push --schema=/app/prisma/schema.prisma --skip-generate fi -exec gosu nextjs:nodejs "$@" +echo "Booting OfflineAcademy..." +exec gosu nextjs:nodejs "$@" \ No newline at end of file