hongbo-miao/hongbomiao.com

View on GitHub
api-node/docker-compose.development.yaml

Summary

Maintainability
Test Coverage
# https://docs.docker.com/compose/compose-file/compose-versioning

---
version: "3.8"
services:
  # API
  api-node:
    container_name: hm_api_node
    build:
      context: ..
      dockerfile: api-node/Dockerfile.development
    env_file:
      - .env.development.local.example.docker
    volumes:
      - ./:/usr/src/app/api-node/
      - /usr/src/app/api-node/node_modules/
    restart: unless-stopped
    ports:
      - "5000:5000"
    depends_on:
      - redis
      - postgres

  # Redis
  redis:
    container_name: hm_redis
    image: redis:7.4.1-alpine
    volumes:
      - redis_data:/data
    restart: unless-stopped
    ports:
      - "6379:6379"

  # PostgreSQL
  postgres:
    container_name: hm_postgres
    image: postgres:16.4-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./postgres/init_up.sql:/docker-entrypoint-initdb.d/init.sql
    env_file:
      - ./postgres/.env.development.local.example
    restart: unless-stopped
    ports:
      - "5432:5432"

# For persistence between restarts
volumes:
  redis_data: {}
  postgres_data: {}