diff --git a/db.docker-compose.yml b/db.docker-compose.yml new file mode 100644 index 0000000..d0fa60a --- /dev/null +++ b/db.docker-compose.yml @@ -0,0 +1,48 @@ +services: + postgres: + image: postgres:alpine + networks: + - bot + restart: always + ports: + - "5432:5432" + environment: + POSTGRES_DB: ${PSQL_NAME} + POSTGRES_USER: ${PSQL_USER} + POSTGRES_PASSWORD: ${PSQL_PASS} + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${PSQL_USER} -d ${PSQL_NAME}"] + interval: 2s + retries: 5 + timeout: 10s + volumes: + - ./scripts/postgres:/docker-entrypoint-initdb.d + - postgres_data:/var/lib/postgresql/data + mongo: + image: mongo:noble + networks: + - bot + restart: always + ports: + - "27017:27017" + environment: + MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER} + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS} + MONGO_INIDB_DATABASE: ${MONGO_NAME} + volumes: + - ./scripts/mongo:/docker-entrypoint-initdb.d + - mongo_data:/data/db + redis: + image: redis:alpine + networks: + - bot + restart: always + ports: + - "6379:6379" + +networks: + bot: + driver: bridge +volumes: + postgres_data: + mongo_data: \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7746e01..d06e64c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,46 +1,7 @@ +include: + - db.docker-compose.yml + services: - postgres: - image: postgres:alpine - networks: - - bot - restart: always - ports: - - "5432:5432" - environment: - POSTGRES_DB: ${PSQL_NAME} - POSTGRES_USER: ${PSQL_USER} - POSTGRES_PASSWORD: ${PSQL_PASS} - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${PSQL_USER} -d ${PSQL_NAME}"] - interval: 2s - retries: 5 - timeout: 10s - volumes: - - ./scripts/postgres:/docker-entrypoint-initdb.d - - postgres_data:/var/lib/postgresql/data - mongo: - image: mongo:noble - networks: - - bot - restart: always - ports: - - "27017:27017" - environment: - MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER} - MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS} - MONGO_INIDB_DATABASE: ${MONGO_NAME} - volumes: - - ./scripts/mongo:/docker-entrypoint-initdb.d - - mongo_data:/data/db - - redis: - image: redis:alpine - networks: - - bot - restart: always - ports: - - "6379:6379" - bot: env_file: - .env @@ -61,7 +22,4 @@ services: networks: bot: - driver: bridge -volumes: - postgres_data: - mongo_data: \ No newline at end of file + driver: bridge \ No newline at end of file