#!/bin/bash

# 替换构建号
sed -i "s/build_number/jenkins构建号：$BUILD_NUMBER/g" src/main/webapp/WEB-INF/cgi/head.sh
# 打包项目
mvn package

# 将构建号当作镜像标签
sed -i "s/image: jxcms/image: jxcms:$BUILD_NUMBER/g" docker-compose.yml
sed -i "s/image: jxnginx/image: jxnginx:$BUILD_NUMBER/g" docker-compose.yml

# 调用docker-compose构建镜像
docker-compose build

# 调用docker-compose启动容器
docker-compose up -d
