Fix SQLite readonly: entrypoint must run as root to fix volume permissions

Entrypoint ran as USER node (inherited from Dockerfile) so chown
silently failed with EPERM. SQLite needs write access to the directory
to create WAL/journal files alongside the database.

- Remove USER node from Dockerfile so entrypoint runs as root
- Restore mkdir /app/data + chown for fresh volume initialization
- Entrypoint now fixes ownership then drops to node via runuser before exec
This commit is contained in:
Chris Scott committed 2026-04-07 23:19:51 -04:00
1 parent 2831533777
commit 1b4c4f2c30
2 files changed
+6 -14

No files matched your search

+2 -5
View File
@@ -93,17 +93,14 @@ RUN mkdir -p /app/backend/node_modules/@opencode-manager && \
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
RUN mkdir -p /workspace && \
chown -R node:node /workspace
# Note: /app/data is a Docker volume, permissions are handled at runtime in entrypoint
RUN mkdir -p /workspace /app/data && \
chown -R node:node /workspace /app/data
EXPOSE 5003 5100 5101 5102 5103
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD curl -f http://localhost:5003/api/health || exit 1
USER node
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bun", "backend/src/index.ts"]
+4 -9
View File
@@ -75,14 +75,9 @@ if [ -z "$AUTH_SECRET" ]; then
exit 1
fi
# Fix database directory permissions for Docker volumes
# Docker volumes are mounted at runtime and may have incorrect ownership
if [ -d "/app/data" ]; then
echo "🔧 Ensuring database directory permissions..."
chown -R node:node /app/data 2>/dev/null || true
chmod -R 755 /app/data 2>/dev/null || true
echo "✅ Database directory permissions set"
fi
mkdir -p /app/data
chown -R node:node /app/data
chmod -R 755 /app/data
exec "$@"
exec runuser -u node -- "$@"