This commit is contained in:
49
ci-cd-deploy.yml
Normal file
49
ci-cd-deploy.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
# CI/CD Pipeline Deployment Configuration
|
||||
version: '3.8'
|
||||
|
||||
# 构建阶段配置
|
||||
services:
|
||||
# 构建服务 - 用于在 CI/CD 环境中构建镜像
|
||||
builder:
|
||||
image: maven:3.8-openjdk-17
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- .:/app
|
||||
- ~/.m2:/root/.m2 # Maven 缓存
|
||||
environment:
|
||||
- MAVEN_OPTS=-Xmx1024m
|
||||
command: >
|
||||
bash -c "
|
||||
mvn clean package -DskipTests &&
|
||||
mvn jib:build -Djib.to.image=light-delivery-app:$${BUILD_NUMBER:-latest} -Djib.allowInsecureRegistries=true
|
||||
"
|
||||
|
||||
# 应用服务 - 实际部署的服务
|
||||
light-delivery-app:
|
||||
image: light-delivery-app:${IMAGE_TAG:-latest}
|
||||
container_name: light-delivery-app
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8443:8443"
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
- SPRING_DATASOURCE_URL=jdbc:mysql://115.190.121.151:3306/light_delivery?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
- SPRING_DATASOURCE_USERNAME=double
|
||||
- SPRING_DATASOURCE_PASSWORD=Hu@ng1998!
|
||||
- JAVA_OPTS=-Xmx512m
|
||||
- SERVER_PORT=8080
|
||||
volumes:
|
||||
- /etc/ssl/certs:/etc/ssl/certs
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- light-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
networks:
|
||||
light-network:
|
||||
driver: bridge
|
Reference in New Issue
Block a user