xiaowei-system/skills/devops/docker/templates/newapi.docker-compose.yml

38 lines
829 B
YAML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# newapi docker-compose — production-ready example
# 路径templates/newapi.docker-compose.yml
# 用法:把 Go 二进制复制到项目 bin/ 目录docker compose -f 模板 up -d --build
version: "3.9"
services:
newapi:
build:
context: ../
dockerfile: Dockerfile
image: muchen/newapi:latest
container_name: newapi
restart: unless-stopped
ports:
- "3000:3000"
volumes:
# 持久化数据卷
- newapi-data:/data
- newapi-logs:/logs
environment:
- TZ=Asia/Shanghai
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- newapi-net
volumes:
newapi-data:
newapi-logs:
networks:
newapi-net:
driver: bridge