Skip to content

Commit 89e047c

Browse files
committed
feat(docker): add Compose Watch for development hot reload
- Add develop.watch configuration to docker-compose.yml - Sync Python source code changes for hot reload - Rebuild on dependency changes (pyproject.toml, uv.lock) - Restart on config changes (.env, docker-compose.yml) - Ignore Python cache files and build artifacts - Works with single compose file for both dev and production
1 parent 9219eb4 commit 89e047c

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

docker-compose.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ services:
5252
DEVCONTAINER: ${DEVCONTAINER:-0}
5353
volumes:
5454
- ./config:/app/config:ro
55-
- ./src/tux/extensions:/app/tux/extensions:ro
55+
- ./src/tux/custom_modules:/app/tux/custom_modules:ro
5656
- ./assets:/app/assets:ro
57+
# Migration mount - always mounted, controlled by USE_LOCAL_MIGRATIONS env var
58+
- ./src/tux/database/migrations:/app/tux/database/migrations:ro
5759
- tux_cache:/app/.cache
5860
- tux_temp:/app/temp
5961
- tux_user_home:/home/nonroot
@@ -63,6 +65,9 @@ services:
6365
TUX_VERSION: ${VERSION:-dev}
6466
# Development-specific overrides
6567
DEBUG: ${DEBUG:-false}
68+
# Migration control
69+
USE_LOCAL_MIGRATIONS: ${USE_LOCAL_MIGRATIONS:-true}
70+
FORCE_MIGRATE: ${FORCE_MIGRATE:-false}
6671
# Database configuration for Docker
6772
POSTGRES_HOST: tux-postgres
6873
POSTGRES_PORT: 5432
@@ -95,6 +100,44 @@ services:
95100
max-size: 10m
96101
max-file: '3'
97102

103+
# Development mode with hot reload (only active when using --watch)
104+
develop:
105+
watch:
106+
# Sync Python source code changes for hot reload
107+
- action: sync
108+
path: ./src
109+
target: /app/src
110+
ignore:
111+
- __pycache__/
112+
- "*.pyc"
113+
- "*.pyo"
114+
- "*.pyd"
115+
- .pytest_cache/
116+
- .mypy_cache/
117+
- .coverage
118+
# Sync configuration changes
119+
- action: sync
120+
path: ./config
121+
target: /app/config
122+
# Sync custom modules
123+
- action: sync
124+
path: ./src/tux/custom_modules
125+
target: /app/tux/custom_modules
126+
# Sync assets
127+
- action: sync
128+
path: ./assets
129+
target: /app/assets
130+
# Rebuild when dependencies change
131+
- action: rebuild
132+
path: pyproject.toml
133+
- action: rebuild
134+
path: uv.lock
135+
# Restart when environment or Docker config changes
136+
- action: sync+restart
137+
path: .env
138+
- action: sync+restart
139+
path: docker-compose.yml
140+
98141
tux-adminer:
99142
image: adminer:latest
100143
container_name: tux-adminer
@@ -114,8 +157,8 @@ services:
114157
ADMINER_DEFAULT_SERVER: "tux-postgres"
115158
ADMINER_DEFAULT_DB: ${POSTGRES_DB:-tuxdb}
116159
ADMINER_DEFAULT_USERNAME: ${POSTGRES_USER:-tuxuser}
117-
ADMINER_DEFAULT_PASSWORD: ${POSTGRES_PASSWORD:-tuxpass}
118-
ADMINER_AUTO_LOGIN: "${ADMINER_AUTO_LOGIN:-false}"
160+
ADMINER_DEFAULT_PASSWORD: ${POSTGRES_PASSWORD:-ChangeThisToAStrongPassword123!}
161+
ADMINER_AUTO_LOGIN: "${ADMINER_AUTO_LOGIN:-true}"
119162
ADMINER_PLUGINS: "backward-keys tables-filter dump-date dump-json dump-xml dump-zip edit-calendar enum-option foreign-system json-column pretty-json-column table-indexes-structure table-structure"
120163

121164
configs:

0 commit comments

Comments
 (0)