Compare commits
2 Commits
618479634f
...
2f19f28213
| Author | SHA1 | Date | |
|---|---|---|---|
|
2f19f28213
|
|||
|
6e1eceba2f
|
@@ -1,9 +1,5 @@
|
||||
FROM eclipse-temurin:25-jre-alpine
|
||||
|
||||
# Create a non-root user for security
|
||||
RUN addgroup -S spring && adduser -S spring -G spring
|
||||
USER spring:spring
|
||||
|
||||
ARG JAR_FILE
|
||||
|
||||
COPY ${JAR_FILE} app.jar
|
||||
|
||||
30
build/Jenkinsfile
vendored
30
build/Jenkinsfile
vendored
@@ -61,24 +61,22 @@ pipeline {
|
||||
|
||||
stage('Docker Build & Push') {
|
||||
steps {
|
||||
withEnv(['DOCKER_BUILDKIT=0']) {
|
||||
script {
|
||||
def jarPath = sh(script: "ls target/checkout/web-container/target/*.jar | head -n 1", returnStdout: true).trim()
|
||||
def releaseVer = sh(script: "pkgx mvn help:evaluate -Dexpression=project.version -q -DforceStdout -f target/checkout/web-container/pom.xml", returnStdout: true).trim()
|
||||
def registry = env.DOCKER_REGISTRY.toLowerCase()
|
||||
def registryHost = registry.replace("https://", "").replace("http://", "").replaceAll("/\$", "").toLowerCase()
|
||||
def imageTag = "${registryHost}/nbscloud:${releaseVer}".toLowerCase()
|
||||
script {
|
||||
def jarPath = sh(script: "ls target/checkout/web-container/target/*.jar | head -n 1", returnStdout: true).trim()
|
||||
def releaseVer = sh(script: "pkgx mvn help:evaluate -Dexpression=project.version -q -DforceStdout -f target/checkout/web-container/pom.xml", returnStdout: true).trim()
|
||||
def registry = env.DOCKER_REGISTRY.toLowerCase()
|
||||
def registryHost = registry.replace("https://", "").replace("http://", "").replaceAll("/\$", "").toLowerCase()
|
||||
def imageTag = "${registryHost}/nbscloud:${releaseVer}".toLowerCase()
|
||||
|
||||
docker.withRegistry(registry, '') {
|
||||
def customImage = docker.build(imageTag, "-f build/Dockerfile --build-arg JAR_FILE=${jarPath} .")
|
||||
docker.withRegistry(registry, '') {
|
||||
def customImage = docker.build(imageTag, "-f build/Dockerfile --build-arg JAR_FILE=${jarPath} .")
|
||||
|
||||
if (params.DRY_RUN) {
|
||||
echo "DRY_RUN - do not push image to registry"
|
||||
}
|
||||
else {
|
||||
customImage.push("${releaseVer}")
|
||||
customImage.push("latest")
|
||||
}
|
||||
if (params.DRY_RUN) {
|
||||
echo "DRY_RUN - do not push image to registry"
|
||||
}
|
||||
else {
|
||||
customImage.push("${releaseVer}")
|
||||
customImage.push("latest")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user