-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsFile
59 lines (52 loc) · 1.73 KB
/
JenkinsFile
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
58
59
pipeline {
agent any
environment {
DOCKER_HUB_USERNAME = "credentials('mericalp').username"
DOCKER_HUB_PASSWORD = "credentials('dckr_pat_VH_jdCgh3Ubdb9PrtkMAPrAUTjs').password"
DOCKER_HUB_IMAGE_NAME = 'mericalp/mern-stack'
IMAGE_TAG = "v${env.BUILD_NUMBER}"
}
stages {
stage('Checking Docker version') {
steps {
sh 'docker -v'
}
}
stage('Login to Docker Hub') {
steps{
sh 'docker login -u mericalp -p dckr_pat_VH_jdCgh3Ubdb9PrtkMAPrAUTjs'
echo 'Login Completed'
}
}
stage('Build and Push to Docker Hub') {
steps {
dir('/var/jenkins_home/workspace/mern-stack/mern-stack-ci-cd-fargate') {
sh "docker build -t mericalp/mern-stack ."
sh "docker tag mericalp/mern-stack:latest mericalp/mern-stack:lts"
sh "docker push mericalp/mern-stack:lts"
}
}
}
stage('Terraform Init') {
steps {
dir('/var/jenkins_home/workspace/mern-stack/mern-stack-ci-cd-fargate/tf') {
sh 'terraform init'
}
}
}
stage('Terraform Plan') {
steps {
dir('tf') {
sh 'terraform plan'
}
}
}
// stage('Terraform Apply') {
// steps {
// dir('tf') {
// sh 'terraform apply -auto-approve'
// }
// }
// }
}
}