refactor: compose files

This commit is contained in:
Sonny
2024-10-27 18:39:43 +01:00
parent 57373ff0b6
commit 05c867f44f
3 changed files with 64 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
name: dev-stack
name: my-links-dev
services:
postgres:
container_name: postgres
@@ -9,26 +9,54 @@ services:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
healthcheck:
test: ['CMD-SHELL', 'pg_isready']
test: ["CMD-SHELL", "pg_isready", "-U", "${DB_USER}"]
volumes:
- postgres_volume:/var/lib/postgresql/data
- postgres-volume:/var/lib/postgresql/data
ports:
- '${DB_PORT}:5432'
- "${DB_PORT}:5432"
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4:8
restart: always
entrypoint: /bin/sh -c "chmod 0600 /pgpass; /entrypoint.sh;"
healthcheck:
test: ["CMD", "wget", "-O", "-", "http://localhost:80/misc/ping"]
interval: 2s
timeout: 10s
retries: 30
env_file: .env
environment:
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
- PGADMIN_DEFAULT_PASSWORD=a12345678
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
depends_on:
- postgres
volumes:
- ./docker-config/servers_pgadmin.json:/pgadmin4/servers.json
ports:
- '5050:80'
- "5050:80"
user: root
configs:
- source: servers.json
target: /pgadmin4/servers.json
- source: pgpass
target: /pgpass
volumes:
postgres_volume:
name: postgres_test_dev_stack
postgres-volume:
configs:
pgpass:
content: postgres:${DB_PORT}:*:${DB_USER}:${DB_PASSWORD}
servers.json:
content: |
{"Servers": {"1": {
"Group": "Servers",
"Name": "project",
"Host": "postgres",
"Port": ${DB_PORT},
"MaintenanceDB": "${DB_DATABASE}",
"Username": "${DB_USER}",
"PassFile": "/pgpass",
"SSLMode": "prefer"
}}}