feat: Add Docker Compose setup for Cassandra, PHP-FPM, and Nginx services.
This commit is contained in:
58
docker-compose.yml
Normal file
58
docker-compose.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user