Skip to content

Instantly share code, notes, and snippets.

@HRMPW
Last active March 29, 2017 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HRMPW/35bc965f523743a74496c2deb2075879 to your computer and use it in GitHub Desktop.
Save HRMPW/35bc965f523743a74496c2deb2075879 to your computer and use it in GitHub Desktop.
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