forked from akannan1087/myPythonDockerRepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
37 lines (35 loc) · 1.29 KB
/
Jenkinsfile
File metadata and controls
37 lines (35 loc) · 1.29 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
pipeline{
agent any
environment{
registry = "439042917544.dkr.ecr.us-east-1.amazonaws.com/test2-repo"
}
stages{
stage("checkout"){
steps{
checkout checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url:[[url: 'https://github.com/Tejaswini3108/myPythonDockerRepo.git']])
}
}
stage("Docker Build"){
steps{
script{
dockerImage = docker.build registry
}
}
}
stage("Docker Push"){
steps{
script{
sh 'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 439042917544.dkr.ecr.us-east-1.amazonaws.com'
sh 'docker push 439042917544.dkr.ecr.us-east-1.amazonaws.com/test2-repo:latest'
}
}
stage('Docker Run'){
steps{
script{
sh 'docker run -d -p 8096:5000 --rm --name mypythonContainer 439042917544.dkr.ecr.us-east-1.amazonaws.com/test2-repo:latest'
}
}
}
}
}
}