Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangdongdong
test
Commits
76afaa5a
Commit
76afaa5a
authored
Sep 28, 2021
by
zhangdd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建shell文件
Signed-off-by:
zhangdd
<
86431843@qq.com
>
parent
2c334a5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
pom.xml
pom.xml
+5
-0
sh/hello.sh
sh/hello.sh
+76
-0
No files found.
pom.xml
View file @
76afaa5a
...
@@ -30,6 +30,11 @@
...
@@ -30,6 +30,11 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
sh/hello.sh
0 → 100644
View file @
76afaa5a
#!/usr/bin/env bash
docker ps
>
/dev/null 2>&1
if
[
"
$?
"
-ne
0
]
;
then
echo
"Docker is not running correctly!"
exit
1
fi
if
[
$#
-lt
1
]
;
then
echo
"Please specify spring active profile name!"
exit
1
fi
SPRING_PROFILE
=
"
$1
"
parentGroupId
=
$(
mvn
help
:evaluate
-Dexpression
=
project.parent.groupId
-q
-DforceStdout
)
hasParent
=
false
if
[[
"
$parentGroupId
"
==
"com.aijiao"
*
||
"
$parentGroupId
"
==
"com.schbrain"
*
]]
;
then
hasParent
=
true
fi
if
[
"
$hasParent
"
==
true
]
;
then
SERVICE
=
$(
mvn
help
:evaluate
-Dexpression
=
project.parent.artifactId
-q
-DforceStdout
)
else
SERVICE
=
$(
mvn
help
:evaluate
-Dexpression
=
project.artifactId
-q
-DforceStdout
)
fi
if
[
"
$hasParent
"
==
true
]
;
then
cd
..
fi
mvn
-Dmaven
.test.skip clean
install
if
[
$?
-ne
0
]
;
then
echo
"Maven install failed!"
exit
1
fi
if
[
"
$hasParent
"
==
true
]
;
then
cd
-
fi
VERSION
=
$(
mvn
help
:evaluate
-Dexpression
=
project.version
-q
-DforceStdout
)
CONTAINER_NAME
=
"
$SERVICE
"
_
"
$SPRING_PROFILE
"
docker stop
"
$CONTAINER_NAME
"
docker
rm
"
$CONTAINER_NAME
"
existImageId
=
`
docker images |grep
"
$SERVICE
"
|grep
"
$VERSION
"
_
"
$SPRING_PROFILE
"
|awk
'{print $3}'
`
if
[
-n
"
$existImageId
"
]
;
then
echo
"Removing exist image:
$existImageId
"
docker rmi
"
$existImageId
"
fi
if
[
!
-d
"target"
]
;
then
echo
"target dir not exits!"
exit
1
fi
cd
target
git archive
-o
dockerfiles.zip
--format
=
zip
--remote
=
git@gitlab.schbrain.com:schbrain-pub/dockerfiles.git 2.0:common
unzip
-o
dockerfiles.zip
&&
rm
-f
dockerfiles.zip
TEST_MEM_OPTS
=
""
ONLINE_MEM_OPTS
=
""
if
[[
"
$SPRING_PROFILE
"
=
~
"online"
||
"
$SPRING_PROFILE
"
=
~
"pre"
]]
;
then
if
[
!
-z
"
$ONLINE_MEM_OPTS
"
]
;
then
sed
-i
""
"s/MEM_OPTS=.*/MEM_OPTS=
\"
$ONLINE_MEM_OPTS
\"
/"
run-app.sh
fi
else
if
[
!
-z
"
$TEST_MEM_OPTS
"
]
;
then
sed
-i
""
"s/MEM_OPTS=.*/MEM_OPTS=
\"
$TEST_MEM_OPTS
\"
/"
run-app.sh
fi
fi
cd
..
profile
=
""
if
[[
"
$SPRING_PROFILE
"
=
~
"online"
||
"
$SPRING_PROFILE
"
=
~
"pre"
]]
;
then
profile
=
"-Ponline"
fi
mvn
$profile
-Dspring
.profiles.active
=
"
$SPRING_PROFILE
"
dockerfile:build
-U
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment