From d963da40e1643e11bb478871186d27e94d06882f Mon Sep 17 00:00:00 2001 From: "m.jalmoudy" Date: Tue, 2 Dec 2025 10:13:35 +0330 Subject: [PATCH] feat: Add Docker Compose setup for Cassandra, PHP-FPM, and Nginx services. --- docker-compose.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a09c43c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,58 @@ +services: + # 🐘 Cassandra Database Container + cassandra: + image: cassandra:latest + container_name: cassandra-db + ports: + # Map the CQL native protocol port (required for client connections) + - '9042:9042' + volumes: + # Optional: Persist data outside the container + - ./docker/cassandra:/var/lib/cassandra + environment: + # Set the cluster name (optional, but good practice) + - CASSANDRA_CLUSTER_NAME=MainCluster + # Set the IP address of the node for other nodes to connect to + - CASSANDRA_BROADCAST_ADDRESS=cassandra-db + # Set the seed provider to itself for a single-node setup + - CASSANDRA_SEEDS=cassandra-db + healthcheck: + test: [ "CMD-SHELL", "cqlsh -e 'describe cluster' || exit 1" ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + restart: always + + # PHP-FPM Container + app: + build: + context: ./docker/php + dockerfile: Docker + container_name: php-app + # Mount the source code into the container's web root + volumes: + - ./src:/var/www/html + # PHP-FPM runs on port 9000 by default + expose: + - '9000' + depends_on: + cassandra: + condition: service_healthy + restart: always + + # Nginx Web Server Container + nginx: + image: nginx:stable-alpine + container_name: nginx-web + ports: + # Map host port 10010 to container port 80 + - '10010:80' + volumes: + # Mount the source code (same path as PHP-FPM) + - ./src:/var/www/html + # Override Nginx default configuration + - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf + depends_on: + - app + restart: always