常见组件docker-compose编排

services:
  redis-server:
    image: "redis:7.2.4"
    container_name: redis-server
    restart: always
    command: --requirepass password
    networks:
      - test
    mem_limit: 500m
    healthcheck:
      test: [ "CMD", "redis-cli" ,"ping" ]
      interval: 5s
      timeout: 10s
      retries: 10
  mysql-server:
    image: "mysql:8.3.0"
    container_name: mysql-server
    mem_limit: 1g
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: test
      TZ: Asia/Shanghai
    volumes:
      - ./sql/test.sql:/docker-entrypoint-initdb.d/test.sql
      - test:/var/lib/mysql
    restart: always
    networks:
      - test
    command:
      --max_connections=1000
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
    healthcheck:
      test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
      interval: 5s
      timeout: 10s
      retries: 10
  minio-server:
    image: "minio/minio:RELEASE.2024-03-10T02-53-48Z"
    container_name: minio-server
    ports:
      - 9000:9000
      - 9001:9001
    restart: always
    command: server /data --console-address ":9001"
    environment:
      MINIO_ROOT_USER: minio
      MINIO_ROOT_PASSWORD: password
    volumes:
      - test-files:/data
    networks:
      - test
    mem_limit: 500m
    logging:
      options:
        max-size: "100k"
        max-file: "3"
    healthcheck:
      test: [ "CMD", "mc", "ready", "local" ]
      interval: 5s
      timeout: 10s
      retries: 10
  test-app:
     build:
       context: ./build
       dockerfile: Dockerfile
     container_name: test-server
     restart: always
     mem_limit: 1g
     ports:
       - 8080:8080
     depends_on:
       mysql-server:
         condition: service_healthy
       redis-server:
         condition: service_healthy
       minio-server:
         condition: service_healthy
     networks:
       - test
networks:
  test:
volumes:
  test:
  test-files:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值