This commit is contained in:
Robin Müller 2023-12-11 14:46:13 +01:00
parent d846b81840
commit 8577e38b8b
2 changed files with 44 additions and 0 deletions

18
automation/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
# npm base container, we need to install some npm dependencies as part of the website build.
FROM node:latest
RUN apt-get update
RUN apt-get --yes upgrade
# Required in case tzdata is a installed, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes install rsync openssh-client
# Install hugo v0.121.1
RUN curl -sSL https://github.com/gohugoio/hugo/releases/download/v0.121.1/hugo_0.121.1_darwin-universal.tar.gz | tar -xz --directory /usr/local/bin
#ssh needs a valid user to work
RUN adduser --uid 114 jenkins
# add documentation server to known hosts
RUN echo "|1|/LzCV4BuTmTb2wKnD146l9fTKgQ=|NJJtVjvWbtRt8OYqFgcYRnMQyVw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts
RUN echo "|1|CcBvBc3EG03G+XM5rqRHs6gK/Gg=|oGeJQ+1I8NGI2THIkJsW92DpTzs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts

26
automation/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,26 @@
pipeline {
agent {
dockerfile {
dir 'automation'
reuseNode true
args '--network host'
}
}
// agent any
stages {
stage('Deployment') {
when {
branch 'main'
}
steps {
sh 'npm install'
sh 'hugo'
sshagent(credentials: ['documentation-buildfix']) {
// Deploy to Apache webserver
sh "rsync -r --delete --exclude 'content/projects/' --exclude static/fonts/univers public/ buildfix@documentation.irs.uni-stuttgart.de:/"
}
}
}
}
}