commit 8dfff24406d04eab43fdcc3e5bee2c05f9e35244 Author: chris Date: Mon May 3 19:15:21 2021 +0200 init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b9b4d9e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM reg.zknt.org/zknt/golang:alpine as builder + +RUN set -xe;\ + go get tildegit.org/solderpunk/molly-brown + +FROM reg.zknt.org/zknt/alpine:3.13 +RUN apk add --no-cache gettext +COPY --from=builder /go/bin/molly-brown /molly-brown +COPY molly.conf /etc/molly.conf.template +VOLUME /cert /var/gemini +EXPOSE 1965 +ENTRYPOINT envsubst < /etc/molly.conf.template > /etc/molly.conf; /molly-brown diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c599361 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,77 @@ +version = "HEAD" +project = "molly-brown" +repo = "zknt" +registry = "reg.zknt.org" +registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5" +timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC')) + +pipeline { + agent any + triggers { + upstream(upstreamProjects: "../golang-alpine/trunk,../alpine/3.13", threshold: hudson.model.Result.SUCCESS) + } + stages { + stage('Build image') { + steps { + withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) { + script { + def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .") + customImage.push(version) + customImage.push("latest") + def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7" + withDockerRegistry([ credentialsId: io_registry_credentials ]) { + def io_registry_image = repo + '/' + project + ':' + version + sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image + sh "docker push " + io_registry_image + sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + ":latest" + sh "docker push " + io_registry_image.split(/\:/)[0] + ":latest" + } + + def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a" + withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) { + def quay_image = 'quay.io/' + repo + '/' + project + ':' + version + sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image + sh "docker push " + quay_image + sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image.split(/\:/)[0] + ":latest" + sh "docker push " + quay_image.split(/\:/)[0] + ":latest" + } + } + } + } + } + } + + post { + always { + sh """docker container prune -f""" + sh """docker image prune -f""" + sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)""" + sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2 | grep -vi -e SCRATCH -e bootstrapped | uniq); do docker rmi -f \$(docker images -q \${image}); done""" + emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+version+'): ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true + } + } + options { + buildDiscarder(BuildHistoryManager([ + [ + conditions: [ + BuildResult(matchFailure: true) + ], + matchAtMost: 4, + continueAfterMatch: false + ], + [ + conditions: [ + BuildResult(matchSuccess: true) + ], + matchAtMost: 4, + continueAfterMatch: false + ], + [ + conditions: [ + BuildResult(matchSuccess: true, matchFailure: true) + ], + actions: [DeleteBuild()] + ] + ])) + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7199716 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Molly Brown + +* Set ENV `HOSTNAME` to your serverd hostname. +* Put your certificate into /cert/cert.pem /cert/key.pem +* Put your docroot in /var/gemini diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..0390a54 --- /dev/null +++ b/build.yaml @@ -0,0 +1,6 @@ +--- +version: "HEAD" +project: molly-brown +trigger_upstream: ../golang-alpine/trunk,../alpine/3.13 +additional_tags: + - latest diff --git a/molly.conf b/molly.conf new file mode 100644 index 0000000..9130cd2 --- /dev/null +++ b/molly.conf @@ -0,0 +1,54 @@ +## Basic settings +# +Port = 1965 +Hostname = "${HOSTNAME}" +CertPath = "/cert/cert.pem" +KeyPath = "/cert/key.pem" +DocBase = "/var/gemini/" +#HomeDocBase = "users" +GeminiExt = "gmi" +#DefaultLang = "fi" +AccessLog = "/dev/stdout" +ErrorLog = "/dev/stderr" +#ReadMollyFiles = true +# +## Directory listing +# +#DirectorySort = "Time" +#DirectoryReverse = true +#DirectoryTitles = true +# +## Dynamic content +# +#CGIPaths = [ +# "/var/gemini/cgi-bin", +# "/var/gemini/users/*/cgi-bin/", # Unsafe! +#] +# +#[SCGIPaths] +#"/scgi-app-1/" = "/var/run/scgi1.sock" +#"/scgi-app-2/" = "/var/run/scgi2.sock" +# +## MIME type overrides +# +#[MimeOverrides] +#"atom.xml$" = "application/atom+xml" +#"rss.xml$" = "application/rss+xml" +# +## Redirects +# +#[TempRedirects] +#"/old/path/file.ext" = "/new/path/file.ext" +#[PermRedirects] +#"/old/path/file.ext" = "/new/path/file.ext" +# +## Certificate zones +# +#[CertificateZones] +#"^/secure-zone-1/" = [ +# "d146953386694266175d10be3617427dfbeb751d1805d36b3c7aedd9de02d9af", +#] +#"^/secure-zone-2/" = [ +# "d146953386694266175d10be3617427dfbeb751d1805d36b3c7aedd9de02d9af", +# "786257797c871bf617e0b60acf7a7dfaf195289d8b08d1df5ed0e316092f0c8d", +#]