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:
@@ -32,7 +32,6 @@ COPY --from=builder /app/docker-entrypoint.sh ./
|
|||||||
RUN chmod +x docker-entrypoint.sh
|
RUN chmod +x docker-entrypoint.sh
|
||||||
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data
|
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data
|
||||||
|
|
||||||
USER nextjs
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME=0.0.0.0
|
ENV HOSTNAME=0.0.0.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
mkdir -p /app/data
|
mkdir -p /app/data
|
||||||
exec node server.js
|
chown -R 1001:1001 /app/data
|
||||||
|
exec su -c "exec node server.js" nextjs
|
||||||
|
|||||||
Reference in New Issue
Block a user