Package legacy database in application image
This commit is contained in:
@@ -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
@@ -7,8 +7,8 @@ The Docker stack contains two services:
|
|||||||
|
|
||||||
## First start and SQLite import
|
## First start and SQLite import
|
||||||
|
|
||||||
1. The legacy SQLite database is included at `data/telco.db`, so Git-based deployments receive
|
1. The legacy SQLite database is included at `data/telco.db` and packaged into the application
|
||||||
the import source automatically.
|
image, so Git-based deployments receive the import source without a host bind mount.
|
||||||
2. Optionally set a database password in a `.env` file:
|
2. Optionally set a database password in a `.env` file:
|
||||||
|
|
||||||
```env
|
```env
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ WORKDIR /app
|
|||||||
|
|
||||||
RUN pip install --no-cache-dir --upgrade pip
|
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
|
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.
|
# Persistent application state (the generated Flask session key) lives in this volume.
|
||||||
VOLUME ["/app/data"]
|
VOLUME ["/app/data"]
|
||||||
|
|||||||
+3
-4
@@ -17,8 +17,9 @@ services:
|
|||||||
|
|
||||||
telcoportal:
|
telcoportal:
|
||||||
build:
|
build:
|
||||||
context: ./TelcoPortal-source
|
# Use the repository root so the tracked legacy database is packaged into the image.
|
||||||
dockerfile: Dockerfile
|
context: .
|
||||||
|
dockerfile: TelcoPortal-source/Dockerfile
|
||||||
container_name: telcoportal
|
container_name: telcoportal
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -28,8 +29,6 @@ services:
|
|||||||
- "8092:8000"
|
- "8092:8000"
|
||||||
volumes:
|
volumes:
|
||||||
- telco-app-data:/app/data
|
- telco-app-data:/app/data
|
||||||
# Read-only source for the automatic first-run SQLite import.
|
|
||||||
- ./data:/app/legacy-data:ro
|
|
||||||
environment:
|
environment:
|
||||||
TELCO_DATA_DIR: /app/data
|
TELCO_DATA_DIR: /app/data
|
||||||
TELCO_DB_HOST: db
|
TELCO_DB_HOST: db
|
||||||
|
|||||||
Reference in New Issue
Block a user