Files
simple-web-file-upload/Dockerfile
T
Stefan Hacker 20e61aa61c 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>
2026-04-16 13:20:02 +02:00

32 lines
726 B
Docker

FROM node:20-bookworm-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ gosu \
&& rm -rf /var/lib/apt/lists/*
COPY package.json ./
RUN npm install --omit=dev
COPY src ./src
COPY public ./public
# Prepare mount points with UID 1000 ownership so named volumes inherit it.
RUN mkdir -p /data/db /data/uploads /data/logo /webdav-config \
&& chown -R 1000:1000 /data /webdav-config /app
ENV NODE_ENV=production \
PORT=3000 \
UPLOAD_ROOT=/data/uploads \
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"]