version: '3.8' # Use a recent version services: # --- Web API --- api: build: # Tells docker-compose to build the Dockerfile in the current directory context: . ssh: ["default"] # Uses host's SSH agent container_name: textsender_api # Optional: Give the container a specific name ports: # Map host port 8000 to container port 3000 (adjust as needed) - "9081:9081" env_file: - .env depends_on: main_db: condition: service_healthy networks: - textsender_api-network restart: unless-stopped # Optional: Restart policy # --- Auth API --- auth_api: build: # Might want to change the naming convention at some point for the repo names. textsender-models, textsender_auth, textesender-api, etc context: ../textsender_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) ssh: ["default"] # Uses host's SSH agent dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name container_name: auth_api restart: unless-stopped ports: - "9080:9080" # environment: # Environment variables your API needs, e.g., database connection # Add other necessary environment variables env_file: - ../textsender_auth/.env depends_on: auth_db: condition: service_healthy networks: - textsender_api-network # Optional: Mount local code for development (live reload) # volumes: # - ./path/to/your/web-api-repo:/app # --- catapult service --- # catapult: # build: # context: ../catapult # ssh: ["default"] # dockerfile: Dockerfile # container_name: catapult # restart: unless-stopped # env_file: # - ../catapult/.env # depends_on: # - api # - main_db # - auth_api # - auth_db # networks: # - textsender_api-network # PostgreSQL Database Service # --- textsender_api web api db --- main_db: image: postgres:18.3-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: textsender_api_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: ${DB_MAIN_USER:-textsender_api} POSTGRES_PASSWORD: ${DB_MAIN_PASSWORD:-password} POSTGRES_DB: ${DB_MAIN_NAME:-textsender_api_db} volumes: # Persist database data using a named volume - postgres_data:/var/lib/postgresql ports: # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) - "5433:5432" healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] interval: 10s timeout: 5s retries: 5 start_period: 10s restart: always # Optional: Restart policy networks: - textsender_api-network # --- textsender_api web auth api db --- auth_db: image: postgres:18.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: textsender_api_auth_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: ${DB_AUTH_USER:-textsender_api_op} POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password} POSTGRES_DB: ${DB_AUTH_NAME:-textsender_api_auth_db} volumes: # Persist database data using a named volume - postgres_data_auth:/var/lib/postgresql ports: # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) - "5432:5432" healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] interval: 10s timeout: 5s retries: 5 start_period: 10s restart: always # Optional: Restart policy networks: - textsender_api-network # Define the named volume for data persistence volumes: postgres_data: driver: local # Use the default local driver postgres_data_auth: driver: local # Use the default local driver # Define the network (optional, but good practice) networks: textsender_api-network: driver: bridge