diff --git a/docker-compose.yml b/docker-compose.yml index 1b38904..7055f9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,6 @@ version: "3.8" services: - db: - image: postgres:14 - restart: always - volumes: - - db_data:/var/lib/postgresql/data - environment: - POSTGRES_USER: ${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd} - POSTGRES_DB: db - PGDATABASE: db - PGPASSWORD: ${POSTGRES_PASSWORD:-passwd} - PGUSER: ${POSTGRES_USER:-postgres} - ports: - - '127.0.0.1:${LOCAL_DB_PORT:-15432}:5432' - app: build: . # restart: always @@ -31,5 +16,24 @@ services: timeout: 10s retries: 3 + db: + image: postgres:14 + restart: always + volumes: + - db_data:/var/lib/postgresql/data + environment: + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd} + POSTGRES_DB: db + PGDATABASE: db + PGPASSWORD: ${POSTGRES_PASSWORD:-passwd} + PGUSER: ${POSTGRES_USER:-postgres} + ports: + - '127.0.0.1:${LOCAL_DB_PORT:-15432}:5432' + healthcheck: + test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}"] + interval: 30s + retries: 5 + volumes: db_data: