-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
68 lines (61 loc) · 2.04 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
60
61
62
63
64
65
66
67
68
pipeline {
agent any
environment {
NODEJS_HOME = tool 'NodeJS'
PATH = "$NODEJS_HOME/bin:${env.PATH}"
DOCKER_IMAGE = 'testjenkinsvue'
LOCAL_DOCKER_SERVER = 'unix:///var/run/docker.sock' // Replace with your local Docker server address
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Copy .env file to workspace') {
steps {
withCredentials([file(credentialsId: 'LEARNING_CARDS_ENV_FILE', variable: 'env_file')]) {
script {
def envContent = readFile(env_file)
writeFile file: '.env', text: envContent
}
}
}
}
stage('Copy application.properties file to workspace (java)') {
steps {
withCredentials([file(credentialsId: 'LEARNING_CARDS_APPLICATION_PROPERTIES', variable: 'application_properties')]) {
script {
def appContent = readFile(application_properties)
writeFile file: 'backend/src/main/resources/application.properties', text: appContent
}
}
}
}
stage('Copy manifest.json file to workspace') {
steps {
withCredentials([file(credentialsId: 'LEARNING_CARDS_MANIFESTJSON', variable: 'manifestjson')]) {
script {
def manifestContent = readFile(manifestjson)
writeFile file: 'frontend/public/manifest.json', text: manifestContent
}
}
}
}
stage('Run ./build.sh') {
steps {
script {
sh "./build.sh"
}
}
}
}
post {
success {
echo 'Build and local deployment successful!'
}
failure {
echo 'Build or local deployment failed!'
}
}
}