fix: persist SQLite database via host bind mount

Mount ./data:/app/data in both compose files and set DATABASE_URL to
the absolute path /app/data/velxio.db so the database survives container
restarts and updates. Create /app/data in Dockerfile.standalone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pull/10/head
David Montero Crespo 2026-03-06 20:32:36 -03:00
parent 0c3cb21702
commit 03f2d7f22e
3 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,9 @@ RUN arduino-cli config init \
WORKDIR /app
# Data directory for persistent SQLite database (mounted as a volume at runtime)
RUN mkdir -p /app/data
# Install Python backend dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

View File

@ -7,6 +7,10 @@ services:
restart: unless-stopped
ports:
- "3080:80"
environment:
- DATABASE_URL=sqlite+aiosqlite:////app/data/velxio.db
volumes:
- ./data:/app/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s

View File

@ -6,6 +6,10 @@ services:
ports:
- "8001:8001"
restart: unless-stopped
environment:
- DATABASE_URL=sqlite+aiosqlite:////app/data/velxio.db
volumes:
- ./data:/app/data
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')"]
interval: 30s