Package legacy database in application image

This commit is contained in:
2026-09-23 10:38:58 +02:00
parent 594f96ab1b
commit 68344deb04
4 changed files with 17 additions and 8 deletions
+8
View File
@@ -0,0 +1,8 @@
.git/
TelcoPortal-data/
data/*
!data/telco.db
TelcoPortal-source/__pycache__/
TelcoPortal-source/*.pyc
TelcoPortal-source/.venv/
TelcoPortal-source/venv/
+2 -2
View File
@@ -7,8 +7,8 @@ The Docker stack contains two services:
## First start and SQLite import
1. The legacy SQLite database is included at `data/telco.db`, so Git-based deployments receive
the import source automatically.
1. The legacy SQLite database is included at `data/telco.db` and packaged into the application
image, so Git-based deployments receive the import source without a host bind mount.
2. Optionally set a database password in a `.env` file:
```env
+4 -2
View File
@@ -5,10 +5,12 @@ WORKDIR /app
RUN pip install --no-cache-dir --upgrade pip
COPY requirements.txt .
COPY TelcoPortal-source/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
COPY TelcoPortal-source/ .
RUN mkdir -p /app/legacy-data
COPY data/telco.db /app/legacy-data/telco.db
# Persistent application state (the generated Flask session key) lives in this volume.
VOLUME ["/app/data"]
+3 -4
View File
@@ -17,8 +17,9 @@ services:
telcoportal:
build:
context: ./TelcoPortal-source
dockerfile: Dockerfile
# Use the repository root so the tracked legacy database is packaged into the image.
context: .
dockerfile: TelcoPortal-source/Dockerfile
container_name: telcoportal
restart: unless-stopped
depends_on:
@@ -28,8 +29,6 @@ services:
- "8092:8000"
volumes:
- telco-app-data:/app/data
# Read-only source for the automatic first-run SQLite import.
- ./data:/app/legacy-data:ro
environment:
TELCO_DATA_DIR: /app/data
TELCO_DB_HOST: db