Skip to content

Commit 9353fb5

Browse files
committed
Test chain
1 parent 9aa13dc commit 9353fb5

4 files changed

Lines changed: 27 additions & 30 deletions

File tree

CI/Jenkinsfile

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,40 @@
11
node {
22
def app
3-
def dep
43

54
stage('Clone repository') {
65
checkout scm CI
76

8-
sh 'docker volume create vol-in'
9-
sh 'docker volume create vol-out'
10-
sh 'docker volume ls'
7+
// sh 'docker volume create vol-in'
8+
// sh 'docker volume create vol-out'
9+
// sh 'docker volume ls'
1110

12-
sh 'docker run -d --rm --name dummy -v vol-in:/vi alpine tail -f /dev/null'
13-
sh 'docker cp . dummy:/vi'
14-
sh 'docker stop dummy'
11+
// sh 'docker run -d --rm --name dummy -v vol-in:/vi alpine tail -f /dev/null'
12+
// sh 'docker cp . dummy:/vi'
13+
// sh 'docker stop dummy'
1514
}
1615

17-
stage('Dependencies') {
18-
checkout scm CI
16+
stage('Dependency image') {
17+
checkout scm CI
1918

20-
dep = docker.build("dependency-image", "./CI/dependency -v vol-in:/vi -v vol-out:/vo")
19+
docker.build("dependency-image", "./CI/dependencies")
2120
}
2221

2322
stage('Build image') {
24-
/* This builds the actual image; synonymous to
25-
* docker build on the command line */
26-
sh 'ls -al CI'
27-
//def dockerfile = 'build.dockerfile'
28-
app = docker.build("build-image", "./CI/build")
23+
app = docker.build("build-image", "./CI/build")
2924
}
3025

3126
stage('Test image') {
32-
/* Ideally, we would run a test framework against our image.
33-
* For this example, we're using a Volkswagen-type approach */
34-
3527
docker.build("test-image", "./CI/test")
3628
// app.inside {
3729
// sh 'echo "Tests passed"'
3830
// }
3931
}
4032

41-
stage('Push image') {
42-
/* Finally, we'll push the image with two tags:
43-
* First, the incremental build number from Jenkins
44-
* Second, the 'latest' tag.
45-
* Pushing multiple tags is cheap, as all the layers are reused. */
46-
// docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
47-
// app.push("${env.BUILD_NUMBER}")
48-
// app.push("latest")
49-
// }
33+
stage('Deploy image') {
34+
docker.build("deploy-image", "./CI/test")
35+
}
36+
37+
stage('Publish image') {
38+
5039
}
5140
}

CI/build/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
FROM node:latest
1+
FROM dependency-image:latest
22

3-
RUN git clone https://github.com/nodejs/nodejs.org
43
WORKDIR /nodejs.org/
54

6-
RUN npm install
75
RUN npm run build
86

97
#EXPOSE 8080

CI/dependencies/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:latest
2+
3+
RUN git clone https://github.com/nodejs/nodejs.org
4+
WORKDIR /nodejs.org/
5+
6+
RUN npm install

CI/deploy/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM build-image:latest
2+
3+
WORKDIR /nodejs.org/
4+
RUN npm start

0 commit comments

Comments
 (0)