Run stages using different container images

The Build/HTML stage needs the Emacs image because it uses Emacs to convert the
org files into html files. The Build/CSS stage runs in an image defined by the
Dockerfile in this repository, installing just make, npm, and lessc to convert
the less files into CSS files. And the Deploy step needs to upload using rsync
overs ssh.
This commit is contained in:
Tom Willemse 2020-10-09 23:07:55 -07:00
parent d9e8ecd246
commit f58fe670d9
2 changed files with 33 additions and 15 deletions

View file

@ -1,5 +1,3 @@
FROM silex/emacs:27.1-alpine-dev FROM alpine:3.12
RUN git clone https://github.com/cask/cask.git /usr/local/cask RUN apk add --no-cache make npm && npm -g install less
ENV PATH="/usr/local/cask/bin:$PATH"
RUN cask upgrade-cask

26
Jenkinsfile vendored
View file

@ -1,4 +1,8 @@
pipeline { pipeline {
stages {
stage('Build') {
parallel {
stage('HTML') {
agent { agent {
docker { docker {
image 'silex/emacs:27.1-alpine-dev' image 'silex/emacs:27.1-alpine-dev'
@ -6,18 +10,34 @@ pipeline {
} }
} }
stages {
stage('Build') {
steps { steps {
sh 'cask' sh 'cask'
sh 'make' sh 'make html'
stash includes: 'public/*', name: 'public_html' stash includes: 'public/*', name: 'public_html'
} }
} }
stage('CSS') {
agent { dockerfile true }
steps {
sh 'make css'
stash includes: 'public/*', name: 'public_css'
}
}
}
}
stage('Deploy') { stage('Deploy') {
agent {
docker {
image 'instrumentisto/rsync-ssh'
}
}
steps { steps {
unstash 'public_html' unstash 'public_html'
unstash 'public_css'
withCredentials([file(credentialsId: 'ryuslash.org-deploy-key', variable: 'KEY_FILE')]) { withCredentials([file(credentialsId: 'ryuslash.org-deploy-key', variable: 'KEY_FILE')]) {
sh 'rsync -e "ssh -p 4511 -i $KEY_FILE" -v -c -r --delete public/ "site@ryuslash.org:public_html/"' sh 'rsync -e "ssh -p 4511 -i $KEY_FILE" -v -c -r --delete public/ "site@ryuslash.org:public_html/"'