v1
This commit is contained in:
45
Jenkinsfile
vendored
Normal file
45
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
pipeline {
|
||||
|
||||
environment {
|
||||
GIT_URL='http://192.168.11.55:4000/GiteaTeam/astro.git'
|
||||
GIT_CREDENTIAL_ID = '82ae2d4d36ce107d337ec03c24c6fd9e39fef6ea'
|
||||
GIT_BRANCH = 'main'
|
||||
REGISTRY = 'pvgharbor.duckdns.org'
|
||||
REGISTRY_CREDENTIAL_ID = 'astro'
|
||||
DOCKER_USERNAME = 'ansible'
|
||||
DOCKER_PASSWORD = 'P@ssw0rd'
|
||||
project = "astro"
|
||||
app_name = "astro"
|
||||
label = "v1.4"
|
||||
images_repository = "${REGISTRY}/${project}/${app_name}"
|
||||
image_name = "${REGISTRY}/${project}/${app_name}:${label}"
|
||||
secret_name = "harbor"
|
||||
docker_registry_auth = "98195b64-dc71-42d6-899b-46dd4b566242"
|
||||
}
|
||||
|
||||
|
||||
|
||||
agent any
|
||||
|
||||
stages {
|
||||
|
||||
stage('SCM Checkout') {
|
||||
steps {
|
||||
git branch: "${GIT_BRANCH}", credentialsId: "${GIT_CREDENTIAL_ID}", url: "${GIT_URL}"
|
||||
}
|
||||
}
|
||||
|
||||
stage('docker build & push') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: "${docker_registry_auth}", passwordVariable: 'password', usernameVariable: 'username')]) {
|
||||
sh ('docker build -t ${image_name} .')
|
||||
sh ('echo "$DOCKER_PASSWORD" | docker login $images_repository -u "$DOCKER_USERNAME" --password-stdin')
|
||||
sh ('docker push $image_name')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user