docker – Blame information for rev 40
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
40 | office | 1 | registry="romancin/rclonebrowser" |
2 | |||
3 | podTemplate(label: 'github-docker-builder', cloud: 'kubernetes', |
||
4 | containers: [ |
||
5 | containerTemplate(name: 'buildkit', image: 'moby/buildkit:master', ttyEnabled: true, privileged: true), |
||
6 | containerTemplate(name: 'docker-readme', image: 'sheogorath/readme-to-dockerhub', command: 'sleep', args: '99d'), |
||
7 | ], |
||
8 | volumes: [ |
||
9 | secretVolume(secretName: 'docker-config', mountPath: '/root/.docker') |
||
10 | ]) { |
||
11 | node('github-docker-builder') { |
||
12 | stage('Cloning Git Repository') { |
||
13 | container('buildkit') { |
||
14 | git url: 'https://github.com/romancin/rclonebrowser-docker.git', |
||
15 | branch: '$BRANCH_NAME' |
||
16 | } |
||
17 | } |
||
18 | stage('Building image and pushing it to the registry (develop)') { |
||
19 | if (env.BRANCH_NAME == 'develop') { |
||
20 | def gitbranch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() |
||
21 | def version = readFile('VERSION') |
||
22 | def versions = version.split('\\.') |
||
23 | def major = gitbranch + '-' + versions[0] |
||
24 | def minor = gitbranch + '-' + versions[0] + '.' + versions[1] |
||
25 | def patch = gitbranch + '-' + version.trim() |
||
26 | container('buildkit') { |
||
27 | sh """ |
||
28 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${gitbranch},push=true |
||
29 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${major},push=true |
||
30 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${minor},push=true |
||
31 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${patch},push=true |
||
32 | """ |
||
33 | } |
||
34 | } |
||
35 | } |
||
36 | stage('Building image and pushing it to the registry (main)') { |
||
37 | if (env.BRANCH_NAME == 'main') { |
||
38 | def gitbranch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() |
||
39 | def version = readFile('VERSION') |
||
40 | def versions = version.split('\\.') |
||
41 | def major = versions[0] |
||
42 | def minor = versions[0] + '.' + versions[1] |
||
43 | def patch = version.trim() |
||
44 | container('buildkit') { |
||
45 | sh """ |
||
46 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:latest,push=true |
||
47 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${major},push=true |
||
48 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${minor},push=true |
||
49 | buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=. --output type=image,name=${registry}:${patch},push=true |
||
50 | """ |
||
51 | } |
||
52 | container('docker-readme') { |
||
53 | withEnv(['DOCKERHUB_REPO_NAME=tinymediamanager']) { |
||
54 | withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'DOCKERHUB_PASSWORD', usernameVariable: 'DOCKERHUB_USERNAME')]) { |
||
55 | sh """ |
||
56 | export DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME} |
||
57 | export DOCKERHUB_PASSWORD=${DOCKERHUB_PASSWORD} |
||
58 | rm -rf /data && ln -s `pwd` /data |
||
59 | cd /data && node --unhandled-rejections=strict /app/index.js |
||
60 | """ |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 | stage('Notify Build Result') { |
||
67 | withCredentials([string(credentialsId: 'discord-webhook-notificaciones', variable: 'DISCORD_WEBHOOK')]) { |
||
68 | discordSend description: "[Jenkins] - Pipeline CI-docker-rclonebrowser", footer: "", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: "${DISCORD_WEBHOOK}" |
||
69 | } |
||
70 | } |
||
71 | } |
||
72 | } |
||
73 | |||
74 | properties([[ |
||
75 | $class: 'BuildDiscarderProperty', |
||
76 | strategy: [ |
||
77 | $class: 'LogRotator', |
||
78 | artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'] |
||
79 | ] |
||
80 | ]); |