mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-11 00:47:38 +00:00
docs: remove hardcoded compose secrets
This commit is contained in:
@@ -585,8 +585,8 @@ services:
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://appuser:password@postgres:5432/myappdb
|
||||
REDIS_URL: redis://redis:6379
|
||||
DATABASE_URL: postgresql://appuser:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@postgres:5432/myappdb
|
||||
REDIS_URL: redis://:${REDIS_PASSWORD:?set REDIS_PASSWORD}@redis:6379
|
||||
LOG_LEVEL: info
|
||||
depends_on:
|
||||
postgres:
|
||||
@@ -618,7 +618,7 @@ services:
|
||||
environment:
|
||||
POSTGRES_DB: myappdb
|
||||
POSTGRES_USER: appuser
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
@@ -635,14 +635,16 @@ services:
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
container_name: redis
|
||||
command: redis-server --appendonly yes --requirepass redispass
|
||||
command: ["sh", "-c", "redis-server --appendonly yes --requirepass \"$$REDIS_PASSWORD\""]
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:?set REDIS_PASSWORD}
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- backend-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
||||
test: ["CMD-SHELL", "redis-cli -a \"$$REDIS_PASSWORD\" ping | grep -q PONG"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
Reference in New Issue
Block a user