* #01 init code
This commit is contained in:
commit
b41f0c3b05
|
@ -0,0 +1,27 @@
|
||||||
|
# 基础镜像
|
||||||
|
FROM openjdk:8-jre
|
||||||
|
# author
|
||||||
|
MAINTAINER afe
|
||||||
|
|
||||||
|
# 挂载目录
|
||||||
|
VOLUME /home/ai
|
||||||
|
# 创建目录
|
||||||
|
RUN mkdir -p /home/ai
|
||||||
|
|
||||||
|
ENV HOSTNAME="ai-data"
|
||||||
|
|
||||||
|
#
|
||||||
|
ARG PROFILE_ACTIVE
|
||||||
|
|
||||||
|
# 指定路径
|
||||||
|
WORKDIR /home/ai
|
||||||
|
# 复制jar文件到路径
|
||||||
|
COPY /target/ai-data.jar /home/ai/ai-data.jar
|
||||||
|
|
||||||
|
#COPY /ai-auth/jar_lib/skywalking /home/ai/skywalking
|
||||||
|
|
||||||
|
ENV TIME_ZONE=Asia/Shanghai
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
|
||||||
|
|
||||||
|
# 启动认证服务
|
||||||
|
ENTRYPOINT ["java", "-Xms512m", "-Xmx512m", "-jar", "ai-data.jar", "--spring.cloud.nacos.discovery.ip=${HOSTNAME}", "--spring.profiles.active=${PROFILE_ACTIVE}"]
|
|
@ -0,0 +1,49 @@
|
||||||
|
#接收外部参数,由jenkinsfile执行部署脚本时传递
|
||||||
|
projectName=$1
|
||||||
|
imageName=$2
|
||||||
|
version=$3
|
||||||
|
profileActive=$4
|
||||||
|
|
||||||
|
echo "镜像名: $imageName"
|
||||||
|
echo "项目名: $projectName"
|
||||||
|
echo "版本号: $version"
|
||||||
|
echo "多环境: $profileActive"
|
||||||
|
# 容器id
|
||||||
|
containerId=$(docker ps -a | grep -w "${projectName}" | awk '{print $1}')
|
||||||
|
if [ "$containerId" != "" ] ;
|
||||||
|
then
|
||||||
|
#停掉容器
|
||||||
|
docker stop "$containerId"
|
||||||
|
#删除容器
|
||||||
|
docker rm "$containerId"
|
||||||
|
echo "成功删除容器"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 镜像id
|
||||||
|
imageId=$(docker images | grep -w "${projectName}" | awk '{print $3}')
|
||||||
|
#if [ "$imageId" != "" ] ;
|
||||||
|
#then
|
||||||
|
#删除镜像
|
||||||
|
#docker rmi --force $(docker images | grep -w "${projectName}" | awk '{print $3}')
|
||||||
|
#echo "成功删除镜像"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
docker login 192.168.3.210:9999
|
||||||
|
|
||||||
|
# 镜像下载
|
||||||
|
docker pull "$imageName"
|
||||||
|
# cd /data/dev/app
|
||||||
|
# 启动容器
|
||||||
|
VERSION="${version}" PROFILE_ACTIVE=${profileActive} docker-compose up -d "${projectName}"
|
||||||
|
echo "容器启动成功"
|
||||||
|
|
||||||
|
|
||||||
|
# 镜像id
|
||||||
|
imageId=$(docker images | grep -w "${projectName}" | awk '{print $3}')
|
||||||
|
#if [ "$imageId" != "" ] ;
|
||||||
|
#then
|
||||||
|
#删除镜像
|
||||||
|
#docker rmi --force $(docker images | grep -w "${projectName}" | awk '{print $3}')
|
||||||
|
#echo "成功删除镜像"
|
||||||
|
#fi
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
ai-auth:
|
||||||
|
image: 192.168.3.210:9999/ai/ai-auth:${VERSION}
|
||||||
|
container_name: ai-auth
|
||||||
|
ports:
|
||||||
|
- "9206:9206"
|
||||||
|
mem_limit: 512m
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-auth/:/data/logs/ai-auth
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-customer:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-customer:${VERSION}
|
||||||
|
container_name: ai-customer
|
||||||
|
ports:
|
||||||
|
- "9204:9204"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-customer/:/data/logs/ai-customer
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-file:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-file:${VERSION}
|
||||||
|
container_name: ai-file
|
||||||
|
ports:
|
||||||
|
- "9208:9208"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-file/:/data/logs/ai-file
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-gateway:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-gateway:${VERSION}
|
||||||
|
container_name: ai-gateway
|
||||||
|
ports:
|
||||||
|
- "8088:8088"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-gateway/:/data/logs/ai-gateway
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-job:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-job:${VERSION}
|
||||||
|
container_name: ai-job
|
||||||
|
ports:
|
||||||
|
- "9203:9203"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-job/:/data/logs/ai-job
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-news:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-news:${VERSION}
|
||||||
|
container_name: ai-news
|
||||||
|
ports:
|
||||||
|
- "9205:9205"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-news/:/data/logs/ai-news
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-route:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-route:${VERSION}
|
||||||
|
container_name: ai-route
|
||||||
|
ports:
|
||||||
|
- "9207:9207"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-route/:/data/logs/ai-route
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
ai-system:
|
||||||
|
image: 192.168.2.210:9999/ai/ai-system:${VERSION}
|
||||||
|
container_name: ai-system
|
||||||
|
ports:
|
||||||
|
- "9201:9201"
|
||||||
|
environment:
|
||||||
|
PROFILE_ACTIVE: ${PROFILE_ACTIVE}
|
||||||
|
volumes:
|
||||||
|
- /data/logs/ai-system/:/data/logs/ai-system
|
||||||
|
restart:
|
||||||
|
always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
external:
|
||||||
|
name: docker_default
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.afe</groupId>
|
||||||
|
<artifactId>ai-common</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ai-data</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
ai-data数据中心
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Web -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Common Security-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.afe</groupId>
|
||||||
|
<artifactId>ai-common-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Ai Customer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.afe</groupId>
|
||||||
|
<artifactId>ai-api-customer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Websocket -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Common Baffle -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.afe</groupId>
|
||||||
|
<artifactId>ai-common-baffle</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot 测试 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Junit Test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in New Issue