Auto-create and chown data dirs on first start

Entrypoint runs as root, ensures /data/{db,uploads,logo} and
/webdav-config exist with UID 1000 ownership, then drops privileges
via gosu. Removes the manual sudo chown step from the README and
makes a fresh docker compose up succeed without prep.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-16 13:20:02 +02:00
parent d476784c06
commit 20e61aa61c
4 changed files with 22 additions and 7 deletions
+5 -1
View File
@@ -3,7 +3,7 @@ FROM node:20-bookworm-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
python3 make g++ gosu \
&& rm -rf /var/lib/apt/lists/*
COPY package.json ./
@@ -22,6 +22,10 @@ ENV NODE_ENV=production \
DB_PATH=/data/db/app.db \
WEBDAV_CONFIG_DIR=/webdav-config
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "src/server.js"]