Scheduler ticks every 5 minutes and snapshots data/avtoambor.db (via better-sqlite3's online backup API) when the DB file's mtime has advanced. After each new backup, prune older snapshots: keep everything from the last 7 days, then one per calendar day. New /admin page lists backups with Download and Restore actions, plus a Back-up-now button. Restore takes a safety snapshot first, closes the live connection, swaps the .db file, and lets the next request reopen. Also: TZ=Asia/Dushanbe in the container so backup filenames use local time, and tzdata added to the image so TZ takes effect. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
15 lines
348 B
Docker
15 lines
348 B
Docker
FROM node:20-bookworm-slim
|
|
|
|
# Tools needed to compile better-sqlite3
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends python3 make g++ ca-certificates tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Run as the node user (uid 1000) — already exists in node images
|
|
USER node
|
|
WORKDIR /app
|
|
|
|
EXPOSE 5173 3000
|
|
|
|
CMD ["npm", "run", "dev"]
|