fix(Docker): require persistent DATA_DIR volume; add VOLUME + README data-persistence warning

Root cause of re-login failing after first-run setup: on EasyPanel/w/o a volume, the
container's /app/backend/data (users, incl. the changed admin password) is wiped on every
recreate, so logging back in with the new password fails. Added:
- ENV DATA_DIR=/app/backend/data (explicit) + VOLUME declaration in Dockerfile
- README 'Data persistence' section: must mount a persistent volume to /app/backend/data

Verified: backend + live server login>setup>relogin-with-new-password works (200); the
failure is deployment data persistence, not login logic.
This commit is contained in:
Macky
2026-08-07 20:20:42 +07:00
parent 273fe7dae5
commit 334ef4e00c
2 changed files with 17 additions and 0 deletions

View File

@@ -28,6 +28,12 @@ COPY backend/ ./backend/
# Run
WORKDIR /app/backend
# Explicit data dir so operators mount a persistent volume here.
# Without a volume, ALL user data (incl. the admin password change from first-run
# setup) is lost on every container recreate -> re-login with the new password fails.
# Persist with: docker run -v ./data:/app/backend/data (or compose ./data)
ENV DATA_DIR=/app/backend/data
ENV FLASK_DEBUG=0
EXPOSE 5001
VOLUME ["/app/backend/data"]
CMD ["python", "run.py"]