24 lines
1.1 KiB
Bash
24 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
JAR_NAME=`ls target | grep api-|grep -v original`
|
|
JAR_VERSION=${JAR_NAME%.*}
|
|
JAR_VERSION=${JAR_VERSION#*-}
|
|
BUILD_TIME=$(date "+%Y%m%d%H%M%S")
|
|
|
|
mkdir target/extracted
|
|
java -Djarmode=layertools -jar target/*.jar extract --destination target/extracted
|
|
|
|
if [[ "${JAR_VERSION}" =~ ^.*SNAPSHOT$ ]]
|
|
then
|
|
docker build -t hub.fatweb.top/oxygen-api:snapshot-latest -t hub.fatweb.top/oxygen-api:$JAR_VERSION -t hub.fatweb.top/oxygen-api:$JAR_VERSION-${BUILD_TIME} .
|
|
cat "${KEYS_PATH}/docker.password" | docker login hub.fatweb.top -u jenkins --password-stdin
|
|
docker push hub.fatweb.top/oxygen-api:snapshot-latest
|
|
docker push hub.fatweb.top/oxygen-api:$JAR_VERSION
|
|
docker push hub.fatweb.top/oxygen-api:$JAR_VERSION-${BUILD_TIME}
|
|
else
|
|
docker build -t hub.fatweb.top/oxygen-api:latest -t hub.fatweb.top/oxygen-api:$JAR_VERSION -t hub.fatweb.top/oxygen-api:$JAR_VERSION-${BUILD_TIME} .
|
|
cat "${KEYS_PATH}/docker.password" | docker login hub.fatweb.top -u jenkins --password-stdin
|
|
docker push hub.fatweb.top/oxygen-api:latest
|
|
docker push hub.fatweb.top/oxygen-api:$JAR_VERSION
|
|
docker push hub.fatweb.top/oxygen-api:$JAR_VERSION-${BUILD_TIME}
|
|
fi |