Skip to content

Commit 5dc4248

Browse files
committed
ci/cd 5
1 parent 918ea49 commit 5dc4248

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

app/Jenkinsfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ pipeline {
22
agent any
33

44
environment {
5-
PROD_DIR = "/opt/docker/site/app"
5+
PROD_DIR = "/opt/docker/site"
6+
SITE_DIR = "/opt/docker/site/static-site"
67
IMAGE_TAG = "static-site:latest"
78
SERVICE_NAME = "static-site"
89
}
@@ -18,12 +19,18 @@ pipeline {
1819
}
1920
}
2021

22+
stage('Sync code into SITE_DIR') {
23+
steps {
24+
sh """
25+
rsync -a --delete ./ ${SITE_DIR}/
26+
"""
27+
}
28+
}
29+
2130
stage('Build static-site:latest on host Docker') {
2231
steps {
23-
// IMPORTANT:
24-
// The working directory here is the Jenkins workspace.
25-
// That workspace MUST contain your Dockerfile and all app code.
2632
sh """
33+
cd ${SITE_DIR}
2734
docker build -t ${IMAGE_TAG} -f Dockerfile .
2835
"""
2936
}

0 commit comments

Comments
 (0)