Update build-docker.sh: add snapshot judgment #6

Merged
FatttSnake merged 1 commits from FatttSnake into dev 2023-10-09 13:53:09 +08:00

View File

@@ -7,8 +7,18 @@ BUILD_TIME=$(date "+%Y%m%d%H%M%S")
mkdir target/extracted mkdir target/extracted
java -Djarmode=layertools -jar target/*.jar extract --destination target/extracted java -Djarmode=layertools -jar target/*.jar extract --destination target/extracted
docker build -t hub.fatweb.top/fatweb-api:latest -t hub.fatweb.top/fatweb-api:$JAR_VERSION -t hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME} .
cat "${KEYS_PATH}/docker.password" | docker login hub.fatweb.top -u jenkins --password-stdin if [[ "${JAR_VERSION}" =~ ^.*SNAPSHOT$ ]]
docker push hub.fatweb.top/fatweb-api:latest then
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION docker build -t hub.fatweb.top/fatweb-api:snapshot-latest -t hub.fatweb.top/fatweb-api:$JAR_VERSION -t hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME} .
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME} cat "${KEYS_PATH}/docker.password" | docker login hub.fatweb.top -u jenkins --password-stdin
docker push hub.fatweb.top/fatweb-api:snapshot-latest
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME}
else
docker build -t hub.fatweb.top/fatweb-api:latest -t hub.fatweb.top/fatweb-api:$JAR_VERSION -t hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME} .
cat "${KEYS_PATH}/docker.password" | docker login hub.fatweb.top -u jenkins --password-stdin
docker push hub.fatweb.top/fatweb-api:latest
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION
docker push hub.fatweb.top/fatweb-api:$JAR_VERSION-${BUILD_TIME}
fi