-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
57 lines (52 loc) · 1.05 KB
/
Jenkinsfile
File metadata and controls
57 lines (52 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def myImage
pipeline {
agent any
environment {
DOCKER_REP = credentials('docker_repository')
DOCKER_USER = credentials('docker_user')
}
stages {
stage('Testing and linting') {
agent {
docker {
image 'python:3.8-slim'
reuseNode true
}
}
steps{
checkout scm
dir('app_python'){
script {
sh """
pip3 install -r requirements.txt
pytest
pip3 install pylama
pylama ./app_python/src
"""
}
}
}
}
stage("Build image"){
agent any
steps{
checkout scm
dir('app_python'){
script{
myImage = docker.build('$DOCKER_USER/$DOCKER_REP', "--target build .")
}
}
}
}
stage("Publish image"){
agent any
steps{
script{
withDockerRegistry(credentialsId: 'docker_pair', url: '') {
myImage.push()
}
}
}
}
}
}