Remove unnecessary values from docker compose. Make env file more parametrized. (#96)

This commit is contained in:
Mirko Jeličić
2025-06-24 10:45:40 +02:00
committed by GitHub
parent 5685770205
commit b0c9b65a43
2 changed files with 8 additions and 6 deletions
+6 -1
View File
@@ -1,6 +1,11 @@
# Database Configuration # Database Configuration
POSTGRES_USER=my-user
POSTGRES_PASSWORD=my-password
POSTGRES_DB=workout-cool
DB_HOST=localhost
DB_PORT=5432
# Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE # Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE
DATABASE_URL=postgresql://username:password@localhost:5432/workout_cool DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}
# Authentication # Authentication
# The URL where your application is running # The URL where your application is running
+2 -5
View File
@@ -3,17 +3,14 @@ services:
image: postgres:15 image: postgres:15
ports: ports:
- "${DB_PORT:-5432}:5432" - "${DB_PORT:-5432}:5432"
environment:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: workout_cool
volumes: volumes:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U username -d workout_cool"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s interval: 5s
timeout: 5s timeout: 5s
retries: 5 retries: 5
env_file: .env
workout_cool: workout_cool:
build: build: