-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
40 lines (39 loc) · 1.14 KB
/
Copy pathdocker-compose.yml
File metadata and controls
40 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
services:
# 个人网站 - 全栈服务 (前端 + 后端)
web:
build:
context: .
dockerfile: Dockerfile
image: personal-website:latest
container_name: personal-website
restart: unless-stopped
network_mode: host
ports:
- "3718:3718" # 前端 (通过 nginx)
- "8080:8080" # 后端 API (可选,主要用于调试)
volumes:
# 数据持久化 - H2 数据库文件
- ./data:/app/data
# 日志持久化
- ./logs:/var/log/supervisor
environment:
# JVM 配置
- JAVA_OPTS=-Xms256m -Xmx512m
# Spring Boot 配置
- SPRING_PROFILES_ACTIVE=prod
- SERVER_PORT=8080
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/public/profile"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# 数据卷说明:
# ./data - H2 数据库文件存储
# ./logs - 应用日志存储
#
# 使用方法:
# 1. 构建并启动: docker-compose up -d --build
# 2. 查看日志: docker-compose logs -f
# 3. 停止服务: docker-compose down
# 4. 进入容器: docker exec -it personal-website sh