def label = "kaniko-${UUID.randomUUID().toString()}" podTemplate( label: label, name: "kaniko", containers: [ containerTemplate( name: "kaniko", image: "gcr.io/kaniko-project/executor:debug", alwaysPullImage: true, ttyEnabled: true, command: "/busybox/cat") ], ) { node (label) { def workspace = pwd() stage("Clone Files") { sh """ git clone https://github.com/RaymiiOrg/ssl-decoder.git git clone https://github.com/RaymiiOrg/certificate-expiry-monitor.git """ } container ("kaniko") { stage("Kaniko Build & Push") { def CE = """ # Compression configuration SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\\.0[678] no-gzip BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)\$ no-gzip dont-vary SetEnvIfNoCase Request_URI \\.(?:exe|t?gz|zip|bz2|sit|rar)\$ no-gzip dont-vary SetEnvIfNoCase Request_URI \\.(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)\$ no-gzip dont-vary SetEnvIfNoCase Request_URI \\.pdf\$ no-gzip dont-vary DocumentRoot "/var/www/html" Require all granted Options Indexes MultiViews FollowSymLinks AllowOverride All IndexIgnore fancy-index """ def DF = """ FROM php:7-apache RUN apt-get update && \\ apt-get install -y libicu-dev python2 python-netaddr libcurl4-openssl-dev libonig-dev libxml2-dev && \\ docker-php-ext-install intl bcmath curl mbstring xml && \\ mkdir -p /var/www/html/ssl-decoder /var/www/html/certificate-expiry-monitor /cert-monitor COPY linux-webserver.conf /etc/apache2/sites-enabled/linux-webserver.conf COPY ssl-decoder /var/www/html/ssl-decoder COPY certificate-expiry-monitor /var/www/html/certificate-expiry-monitor COPY variables.php /var/www/html/certificate-expiry-monitor/functions/variables.php RUN echo '{}' > /var/www/certificate-expiry-monitor-db/pre_checks.json && \ echo '{}' > /var/www/certificate-expiry-monitor-db/checks.json && \ echo '{}' > /var/www/certificate-expiry-monitor-db/deleted_checks.json && \ chown -R 33:33 /var/www/html/* /cert-monitor && \\ sed -i '18s/^.*$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/ssl-decoder/index.php """ writeFile file: workspace + '/linux-webserver.conf', text: AC writeFile file: workspace + '/variables.php', text: CE writeFile file: workspace + '/Dockerfile', text: DF sh '/kaniko/executor --insecure --skip-tls-verify --context "' + workspace + '" -f "' + workspace + '/Dockerfile" --destination registry.test-chamber-13.lan:5000/raymii:latest' } } } }