From 445b1f6c7408436759d9b887c06df6a624245a55 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 9 Oct 2023 13:52:09 +0800 Subject: [PATCH] Update build-docker.sh: add snapshot judgment --- build-docker.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/build-docker.sh b/build-docker.sh index 64321b9..3839b82 100644 --- a/build-docker.sh +++ b/build-docker.sh @@ -7,8 +7,18 @@ BUILD_TIME=$(date "+%Y%m%d%H%M%S") mkdir 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 -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} \ No newline at end of file + +if [[ "${JAR_VERSION}" =~ ^.*SNAPSHOT$ ]] +then + 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} . + 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 \ No newline at end of file