stock-management-demo/docker-compose-example.yml

52 lines
No EOL
2.4 KiB
YAML

services:
postgres_db:
image: postgres:latest # Use the official PostgreSQL image. Pin to a specific version (e.g., postgres:15) for production stability.
container_name: stylepoint_postgres # Define a specific name for this container
restart: unless-stopped # Restart the container unless it is explicitly stopped
environment:
POSTGRES_USER: stylepoint # Database username
POSTGRES_PASSWORD: "{{POSTGRES_PASSWORD_REPLACE_ME}}" # Database password (replace with a secure one, consider using secrets)
POSTGRES_DB: stylepoint # Database name
volumes:
# Mount a named volume 'postgres' to persist database data across container restarts/recreations.
- postgres:/var/lib/postgresql/data
ports:
# Map host port 5432 to container port 5432. Change host port if 5432 is occupied (e.g., "5433:5432").
- "5432:5432"
healthcheck:
# Check if the PostgreSQL server is ready to accept connections
test: ["CMD-SHELL", "pg_isready -U stylepoint"]
interval: 10s
timeout: 5s
retries: 5
minio:
image: quay.io/minio/minio:latest # Use the official MinIO image. Pin to a specific version for production stability.
container_name: stylepoint_minio # Define a specific name for this container
restart: unless-stopped # Restart the container unless it is explicitly stopped
environment:
MINIO_ROOT_USER: stylepoint # MinIO access key (username)
MINIO_ROOT_PASSWORD: "{{MINIO_PASSWORD_REPLACE_ME}}" # MinIO secret key (password - replace with a secure one, consider using secrets)
volumes:
# Mount a named volume 'minio_data' to persist object storage data.
- minio_data:/data
ports:
# Map host port 9000 (API) to container port 9000
- "9000:9000"
# Map host port 9001 (Console UI) to container port 9001
- "9001:9001"
# Start the MinIO server, serve data from /data, and make the console available on port 9001
command: server /data --console-address ":9001"
healthcheck:
# Check if the MinIO server is live and responding
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
# Define named volumes for persistent storage
volumes:
postgres:
driver: local # Use the local driver for the postgres volume
minio_data:
driver: local # Use the local driver for the minio_data volume