-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
img_mvn="maven:3.3.3-jdk-8" # docker image of maven | ||
m2_cache=~/.m2 # the local maven cache dir | ||
|
||
h2 '准备构建项目' | ||
|
||
if which mvn ; then | ||
info '使用本地maven构建项目' | ||
mvn clean package -DskipTests | ||
else | ||
info '使用maven镜像['$img_mvn']构建项目' | ||
docker run --rm \ | ||
-v $m2_cache:/root/.m2 \ | ||
-v $PROJECT_HOME:/usr/src/mymaven \ | ||
-w /usr/src/mymaven \ | ||
$img_mvn mvn clean package -DskipTests | ||
fi | ||
if [ $? -eq 0 ];then | ||
success '项目构建成功' | ||
else | ||
error '项目构建失败' | ||
exit 1 | ||
fi | ||
|
||
h2 '准备构建Docker镜像' | ||
|
||
sudo mv $PROJECT_HOME/$APP_NAME-provider/target/$APP_NAME-*.jar $PROJECT_HOME/$APP_NAME-provider/target/app.jar | ||
|
||
if [ -z $IMAGE_NAME ];then | ||
docker build --rm -t $IMAGE_NAME . | ||
else | ||
docker build --rm -t $APP_NAME:v$VERSION . | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters