diff --git a/dockerfiles/tasks/Jenkinsfile b/dockerfiles/tasks/Jenkinsfile index 8124e6a..6e2e381 100644 --- a/dockerfiles/tasks/Jenkinsfile +++ b/dockerfiles/tasks/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { parameters { choice( name: 'IMAGE', - choices: ['acme-nginx', 'ansible', 'apidocjs', 'composer', 'mondrian', 'php', 'robo'], + choices: ['acme-certbot', 'acme-nginx', 'ansible', 'apidocjs', 'composer', 'mondrian', 'php', 'robo'], description: 'What image would you like to build?' ) } diff --git a/dockerfiles/tasks/acme-certbot/Dockerfile b/dockerfiles/tasks/acme-certbot/Dockerfile new file mode 100644 index 0000000..afb5181 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:focal +MAINTAINER Richard Morgan + +WORKDIR /opt/project + +EXPOSE 80 + +RUN apt-get update && apt-get install -y software-properties-common \ + && add-apt-repository universe && apt-get update && apt-get install -y \ + certbot \ + \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV TERM=xterm +ENTRYPOINT ["/usr/bin/certbot"] diff --git a/dockerfiles/tasks/acme-certbot/Jenkinsfile b/dockerfiles/tasks/acme-certbot/Jenkinsfile new file mode 100644 index 0000000..3d39fdb --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/Jenkinsfile @@ -0,0 +1,17 @@ +pipeline { + agent { label 'docker' } + triggers { + cron('@monthly') + } + options { + disableConcurrentBuilds() + buildDiscarder(logRotator(numToKeepStr: '2')) + } + stages { + stage('Build Image') { + steps { + build job: '_build_image', parameters: [string(name: 'IMAGE', value: 'acme-certbot')], quietPeriod: 1 + } + } + } +} diff --git a/dockerfiles/tasks/acme-certbot/build.sh b/dockerfiles/tasks/acme-certbot/build.sh new file mode 100755 index 0000000..7565525 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +xai build diff --git a/dockerfiles/tasks/acme-certbot/cli/.bash_cli b/dockerfiles/tasks/acme-certbot/cli/.bash_cli new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/tasks/acme-certbot/cli/build b/dockerfiles/tasks/acme-certbot/cli/build new file mode 100755 index 0000000..6819a8a --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/build @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -e + +LOCAL_IMAGE=xaicorp/acme-certbot +TAG=latest +REMOTE_IMAGE=dkregistry.xai-corp.net:5000/${LOCAL_IMAGE}:${TAG} + +build() { + docker build --rm -f Dockerfile -t ${LOCAL_IMAGE} . +} + +build_test() { + echo testing the image + docker run --rm $LOCAL_IMAGE --version | grep 'certbot 0.40' +} + +build_deploy() { + echo push to registry + + docker tag $LOCAL_IMAGE $REMOTE_IMAGE + docker push $REMOTE_IMAGE +} + +print_usage() { + printf "Usage: %s: [-b] [-t] [-d] \n" "$0" + echo -b build + echo -t test + echo -d push to registry + echo -h help + exit 0 +} + +###### +if [ -z "$1" ]; then + build && build_test && build_deploy + exit +fi + +while getopts btdh name +do + case $name in + b) build;; + t) build_test;; + d) build_deploy;; + *) print_usage;; + esac +done diff --git a/dockerfiles/tasks/acme-certbot/cli/build.help b/dockerfiles/tasks/acme-certbot/cli/build.help new file mode 100644 index 0000000..7aa5493 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/build.help @@ -0,0 +1,3 @@ +ARGS - The arguments you wish to provide to this command + +TODO: Fill out the help information for this command. diff --git a/dockerfiles/tasks/acme-certbot/cli/build.usage b/dockerfiles/tasks/acme-certbot/cli/build.usage new file mode 100644 index 0000000..5226895 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/build.usage @@ -0,0 +1 @@ +ARGS... diff --git a/dockerfiles/tasks/acme-certbot/cli/update-scripts b/dockerfiles/tasks/acme-certbot/cli/update-scripts new file mode 100755 index 0000000..4e827fa --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/update-scripts @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +echo -e "\033[36mTODO\033[39m: Implement this command" + + diff --git a/dockerfiles/tasks/acme-certbot/cli/update-scripts.help b/dockerfiles/tasks/acme-certbot/cli/update-scripts.help new file mode 100644 index 0000000..7aa5493 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/update-scripts.help @@ -0,0 +1,3 @@ +ARGS - The arguments you wish to provide to this command + +TODO: Fill out the help information for this command. diff --git a/dockerfiles/tasks/acme-certbot/cli/update-scripts.usage b/dockerfiles/tasks/acme-certbot/cli/update-scripts.usage new file mode 100644 index 0000000..5226895 --- /dev/null +++ b/dockerfiles/tasks/acme-certbot/cli/update-scripts.usage @@ -0,0 +1 @@ +ARGS...