adds openssl

This commit is contained in:
Hyatt 2022-01-26 10:07:36 -06:00
parent 7b1b8c1f2a
commit 80b91056be
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -1,32 +1,40 @@
def label = "jenkins-${UUID.randomUUID().toString()}" #!groovy
def repository = "registry.c.test-chamber-13.lan" def repository = "registry.c.test-chamber-13.lan"
def kanikoImage = "${repository}/library/kaniko:latest"
def repositoryCreds = "harbor-repository-creds" def repositoryCreds = "harbor-repository-creds"
def dockerFile = """
FROM ${repository}/library/alpine:latest
RUN apk add --no-cache openssl && \\
addgroup -g 1000 -S vlmcsd && \\
adduser -u 1000 -G vlmcsd -S -D -h /home/vlmcsd vlmcsd
COPY vlmcsd/bin/vlmcsd vlmcsd/etc/vlmcsd.kmd /home/vlmcsd
EXPOSE 1688/tcp
WORKDIR /home/vlmcsd
HEALTHCHECK --interval=1m --timeout=3s --start-period=10s --retries=3 \
CMD /bin/sh -c 'printf \\'\\n\\' | openssl s_client --connect 127.0.0.1:1688 2> /dev/null | grep \\'CONNECTED\\''
ENTRYPOINT ["/bin/sh", "-c", "./vlmcsd -L 0.0.0.0:1688 -m 5 -t 5 -e -N1 -B1 -r1 -C 1033 -R 1w -A 1h -H 36446 -v -D -j ./vlmcsd.kmd"]
"""
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate ( podTemplate (
label: label, label: label,
name: "pipeline-worker", name: templateName,
yaml: """--- yaml: functions.podYaml(
apiVersion: v1 repo: repository,
kind: Pod templateName: templateName,
spec: kaniko: true,
containers: alpine: true
- name: kaniko )
image: ${kanikoImage}
tty: true
command:
- /busybox/cat
- name: alpine
image: ${repository}/library/alpine:latest
tty: true
command:
- /bin/sh
""",
){ ){
node (label) { node (label) {
def workspace = pwd()
stage ("Pull VLMCSD Source") { stage ("Pull VLMCSD Source") {
dir("vlmcsd") { dir("vlmcsd") {
checkout ([ checkout ([
@ -66,44 +74,11 @@ spec:
} }
} }
container ("kaniko") { functions.buildContainer(
stage ("Prepare Kaniko") { repository: repository,
withCredentials([usernameColonPassword( imageDest: "${repository}/library/vlmcsd:latest",
credentialsId: repositoryCreds, dockerFile: dockerFile,
variable: "dCreds", repoCreds: repositoryCreds,
)]) { )
def dockerJSON = """{
"auths": {
"${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}"
}
}
}"""
sh """
set +x
echo '${dockerJSON}' > /kaniko/.docker/config.json
"""
}
}
stage("Kaniko Build & Push") {
def dockerfile = """
FROM ${repository}/library/alpine:latest
RUN addgroup -g 1000 -S vlmcsd && \\
adduser -u 1000 -G vlmcsd -S -D -h /home/vlmcsd vlmcsd
COPY vlmcsd/bin/vlmcsd vlmcsd/etc/vlmcsd.kmd /home/vlmcsd
EXPOSE 1688/tcp
WORKDIR /home/vlmcsd
ENTRYPOINT ["/bin/sh", "-c", "./vlmcsd -L 0.0.0.0:1688 -m 5 -t 5 -e -N1 -B1 -r1 -C 1033 -R 1w -A 1h -H 36446 -v -D -j ./vlmcsd.kmd"]
"""
writeFile (file: workspace + "/Dockerfile", text: dockerfile)
sh "/kaniko/executor --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/vlmcsd:latest\""
}
}
} }
} }