Skip to content

Instantly share code, notes, and snippets.

@HRMPW
Last active Mar 29, 2017
Embed
What would you like to do?
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