diff --git a/Jenkinsfile b/Jenkinsfile index 2a8dbe2..376634b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,13 @@ pipeline { dockerImage = 'jcabillot/unrar-arm64' } - agent { label 'arm64' } + //agent { label 'arm64' } + agent { + kubernetes { + defaultContainer 'docker' // All `steps` instructions will be executed by this container + yamlFile 'Jenkinsfile-pod-template.yml' + } + } triggers { cron('@midnight') @@ -20,7 +26,7 @@ pipeline { stage('Build image') { steps{ - sh 'docker build --force-rm=true --no-cache=true --pull -t ${dockerImage} .' + sh 'docker build --force-rm=true --no-cache=true --network host --pull -t ${dockerImage} .' } } diff --git a/Jenkinsfile-pod-template.yml b/Jenkinsfile-pod-template.yml new file mode 100644 index 0000000..a7cc769 --- /dev/null +++ b/Jenkinsfile-pod-template.yml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Pod +metadata: + labels: + jenkins: 'true' +spec: + containers: + - name: jnlp + image: 'jcabillot/docker-inbound-agent-arm64' + - name: docker + image: docker:20.10-dind + securityContext: + privileged: true + #volumeMounts: + #- mountPath: '/var/run/docker.sock' + # name: docker-socket + #volumes: + #- name: docker-socket + # hostPath: + # path: '/var/run/docker.sock' + securityContext: + runAsUser: 0