Last active
March 29, 2017 04:11
-
-
Save HRMPW/35bc965f523743a74496c2deb2075879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
stages { | |
stage("Create Dockerfile and Image") { | |
steps { | |
writeFile file: 'Dockerfile', text: '''FROM ubuntu | |
MAINTAINER Patrick Wolf <pwolf@cloudbees.com> | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get upgrade -y''' | |
sh "docker build -t pwolf/myimage ." | |
} | |
} | |
stage("Use Image") { | |
agent { | |
docker { | |
image "pwolf/myimage" | |
reuseNode true | |
} | |
} | |
steps { | |
sh "hostname" | |
} | |
} | |
stage("Use Image2") { | |
agent { | |
docker { | |
image "pwolf/myimage" | |
reuseNode true | |
} | |
} | |
steps { | |
sh "hostname" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment