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:
常见组件docker-compose编排
最新推荐文章于 2024-09-10 21:11:24 发布