fix: fix SQLite database permission error on volume mounts

Entrypoint now runs as root, fixes ownership of /app/data to nextjs:nodejs
(uid 1001), then drops privileges via su before starting the app.
This fixes 'unable to open database file' when the host data/ directory
is created by Docker as root and is not writable by the nextjs user.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
achmad
2026-05-29 19:01:11 +07:00
parent f03259d443
commit 84bbf5ac4b
2 changed files with 2 additions and 2 deletions
-1
View File
@@ -32,7 +32,6 @@ COPY --from=builder /app/docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
mkdir -p /app/data
exec node server.js
chown -R 1001:1001 /app/data
exec su -c "exec node server.js" nextjs