This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
build-containers/deprecated/build-raymii.jenkins

140 lines
4.5 KiB
Plaintext

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 = """
<?php
\$version = 1.4;
\$title = "Certificate Expiry Monitor";
\$current_folder = get_current_folder();
\$timeout = 2;
date_default_timezone_set('UTC');
ini_set('default_socket_timeout', 2);
\$random_blurp = rand(1000,99999);
\$current_domain = "test-chamber-13.lan";
\$current_link = \$current_domain;
\$pre_check_file = '/cert-monitor/pre_checks.json';
\$check_file = '/cert-monitor/checks.json';
\$deleted_check_file = '/cert-monitor/deleted_checks.json';
"""
def MC = """defaults
tls on
tls_certcheck off
tls_starttls on
account default
host example.com
port 25
logfile /var/log/msmtp.log
auto_from on
maildomain smoothnet.org
"""
def AC = """
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
<VirtualHost _default_:80>
# 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"
<Directory "/var/www/html">
Require all granted
Options Indexes MultiViews FollowSymLinks
AllowOverride All
IndexIgnore fancy-index
</Directory>
</VirtualHost>
"""
def DF = """
FROM php:7-apache
RUN apt-get update && \\
mkdir -p /var/www/html/ssl-decoder /var/www/html/certificate-expiry-monitor /cert-monitor && \\
apt-get install -y \\
libicu-dev \\
python2 \\
gettext \\
python-netaddr \\
libcurl4-openssl-dev \\
libonig-dev \\
libxml2-dev \\
libglib2.0-dev \\
libgnutls28-dev \\
automake \\
libtool && \\
apt-get clean && \\
printf '%s\\\n' "sendmail_path = /usr/local/bin/msmtp -t -i" >> /usr/local/etc/php/php.ini && \\
cd /tmp && \\
curl -L https://marlam.de/msmtp/releases/msmtp-1.8.8.tar.xz -o msmtp.tar.xz && \\
tar -x -f msmtp.tar.xz && \\
cd msmtp-1.8.8 && \\
autoreconf -i && \\
./configure && \\
make && \\
make install && \\
rm -rf /tmp/msmtp && \\
touch /var/log/msmtp.log && \\
chmod 777 /var/log/msmtp.log && \\
cd /var/www/html && \\
docker-php-ext-install intl bcmath curl mbstring xml
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
COPY msmtprc /usr/local/etc/msmtprc
RUN printf '%s' "{}" > /cert-monitor/pre_checks.json && \\
printf '%s' "{}" > /cert-monitor/checks.json && \\
printf '%s' "{}" > /cert-monitor/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 && \\
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/index.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/add.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/confirm.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/unsubscribe.php
"""
writeFile file: workspace + '/linux-webserver.conf', text: AC
writeFile file: workspace + '/variables.php', text: CE
writeFile file: workspace + '/Dockerfile', text: DF
writeFile file: workspace + '/msmtprc', text: MC
sh '/kaniko/executor --insecure --skip-tls-verify --context "' + workspace + '" -f "' + workspace + '/Dockerfile" --destination registry.test-chamber-13.lan:5000/raymii:latest'
}
}
}
}