37 lines
848 B
YAML
37 lines
848 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
jenkins-demo:
|
|
build: .
|
|
container_name: jenkins-demo-app
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- SPRING_PROFILES_ACTIVE=docker
|
|
- JAVA_OPTS=-Xms256m -Xmx512m
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
# 可选:添加数据库服务(如果需要)
|
|
# postgres:
|
|
# image: postgres:15-alpine
|
|
# container_name: jenkins-demo-db
|
|
# environment:
|
|
# POSTGRES_DB: jenkins_demo
|
|
# POSTGRES_USER: jenkins_user
|
|
# POSTGRES_PASSWORD: jenkins_password
|
|
# volumes:
|
|
# - postgres_data:/var/lib/postgresql/data
|
|
# ports:
|
|
# - "5432:5432"
|
|
|
|
# volumes:
|
|
# postgres_data:
|