From 810b0a417874b745ae2df93c493fe12a213ea368 Mon Sep 17 00:00:00 2001 From: slawk0 Date: Thu, 29 Aug 2024 23:47:23 +0200 Subject: [PATCH] refactor docker-compose.yaml --- docker-compose.yaml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index f59d9cf..fd2ec14 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,24 @@ version: '3.8' services: + db: + image: postgres:latest + restart: always + user: postgres + volumes: + - db-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: ${PG_USER} + POSTGRES_DB: ${PG_DATABASE} + POSTGRES_PASSWORD: ${PG_PASSWORD} + expose: + - ${PG_PORT} + healthcheck: + test: [ "CMD", "pg_isready", "-U", "${PG_USER}" ] + interval: 10s + timeout: 5s + retries: 5 + web-chat: build: context: . @@ -18,22 +36,5 @@ services: depends_on: - db - db: - image: postgres:latest - restart: always - user: postgres - volumes: - - db-data:/var/lib/postgresql/data - environment: - POSTGRES_USER: ${PG_USER} - POSTGRES_DB: ${PG_DATABASE} - POSTGRES_PASSWORD: ${PG_PASSWORD} - expose: - - ${PG_PORT} - healthcheck: - test: ["CMD", "pg_isready", "-U", "${PG_USER}"] - interval: 10s - timeout: 5s - retries: 5 volumes: db-data: