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