Add Jenkinsfile

This commit is contained in:
victorc 2024-09-26 10:07:02 +00:00
parent 9af1a76095
commit a8689a6b04

47
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,47 @@
pipeline {
agent {
kubernetes {
workspaceVolume persistentVolumeClaimWorkspaceVolume(claimName: 'jenkins-agents-pvc', readOnly: false)
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: jnlp
image: jenkins/inbound-agent:latest
volumeMounts:
- name: workspace-volume
mountPath: /home/jenkins/agent
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
imagePullPolicy: Always
command:
- sleep
args:
- 1d
volumeMounts:
- name: kaniko-secret
mountPath: /kaniko/.docker/config.json
subPath: .dockerconfigjson
- name: workspace-volume
mountPath: /home/jenkins/agent
volumes:
- name: kaniko-secret
secret:
secretName: build-kubix-gitea-credentials
- name: workspace-volume
persistentVolumeClaim:
claimName: jenkins-agents-pvc
"""
}
}
stages {
stage('Build and Push Image with Kaniko') {
steps {
container('kaniko') {
sh '/kaniko/executor --dockerfile=./Dockerfile --context=dir://. --destination=gitea.kubix.siatel.ro/siatel/php:8.1-apache-mysqli'
}
}
}
}
}