Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 22:41:52 +08:00
parent 52aef81c6e
commit 15f2ff5d54
3 changed files with 43 additions and 29 deletions

View File

@ -1,24 +1,21 @@
FROM centos:7
MAINTAINER Jonathan Ervine <jon.ervine@gmail.com>
RUN yum update -y -x setup && yum clean all
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm --import http://packages.icinga.org/icinga.key
RUN curl -L http://packages.icinga.org/epel/ICINGA-release.repo > /etc/yum.repos.d/ICINGA-release.repo
RUN rpm -e --nodeps iputils
RUN yum install -y iputils
RUN yum makecache
RUN yum update -y -x setup && yum clean all && \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
rpm --import http://packages.icinga.org/icinga.key && \
curl -L http://packages.icinga.org/epel/ICINGA-release.repo > /etc/yum.repos.d/ICINGA-release.repo && \
rpm -e --nodeps iputils && \
yum install -y iputils && \
yum makecache && \
yum install -y centos-release-scl icinga2 nagios-plugins-all git icinga2-ido-mysql httpd php php-intl php-theseer-fDOMDocument php-gd php-pecl-imagick php-pdo php-ZendFramework-Db-Adapter-Pdo-Mysql supervisor && \
/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 && \
usermod -a -G icingacmd apache && \
yum install -y icingaweb2 icingacli
VOLUME ["/etc/icinga2", "/etc/icingaweb2", "/var/lib/mysql", "/var/lib/icinga2"]
RUN yum install -y centos-release-scl icinga2 nagios-plugins-all git icinga2-ido-mysql httpd php php-intl php-theseer-fDOMDocument php-gd php-pecl-imagick php-pdo php-ZendFramework-Db-Adapter-Pdo-Mysql supervisor
RUN /usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2
RUN usermod -a -G icingacmd apache
RUN yum install -y icingaweb2 icingacli
ADD start.sh /sbin/start.sh
RUN chmod 755 /sbin/start.sh
ADD apache.ini /etc/supervisord.d/apache.ini
ADD icinga2.ini /etc/supervisord.d/icinga2.ini
ADD php-fm.ini /etc/supervisord.d/php-fm.ini

47
Jenkinsfile vendored
View File

@ -1,17 +1,34 @@
node("docker-node") {
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
git branch: "centos7", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-centos-icinga2", credentialsId: 'jenkins-to-git'
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
stage "build"
def app = docker.build "library/x86_64/centos/icinga2"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
podTemplate(yaml: """
kind: Pod
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251
imagePullPolicy: Always
command:
- /busybox/cat
tty: true
volumeMounts:
- name: jenkins-docker-cfg
mountPath: /kaniko/.docker
volumes:
- name: jenkins-docker-cfg
projected:
sources:
- secret:
name: regcred
items:
- key: .dockerconfigjson
path: config.json
"""
) {
node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'ssh://git@git.ervine.org/jonny/x86_64-centos-icinga2.git', credentialsId: 'jenkins-to-git'
container('kaniko') {
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/centos/icinga2:7'
}
}
}
}

0
start.sh Normal file → Executable file
View File