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-rcon.jenkins
2022-07-04 11:19:30 -05:00

59 lines
1.7 KiB
Groovy

#!groovy
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def dockerFile = """FROM ${repository}/library/alpine:latest as builder
LABEL maintainer="The_Spider <spider@smoothnet.org>"
RUN apk add --no-cache curl jq && \\
VER=\$(curl --silent "https://api.github.com/repos/gorcon/rcon-cli/releases/latest" | jq -r '.tag_name' | sed -r 's/v//') && \\
curl --silent \\
--location \\
"https://nexus.c.test-chamber-13.lan/repository/github-releases/gorcon/rcon-cli/releases/download/v\${VER}/rcon-\${VER}-amd64_linux.tar.gz" \\
| \\
tar -z -x -C /tmp -f - && \\
cp /tmp/rcon-\${VER}-amd64_linux/rcon "/tmp/rcon"
FROM ${repository}/library/alpine:latest
RUN addgroup -S -g 1000 rcon && \\
adduser --disabled-password -G rcon --gecos "rcon" --home "/home/rcon" --shell "/sbin/nologin" --uid 1000 rcon
COPY --from=builder --chown=rcon:rcon /tmp/rcon /home/rcon/rcon
USER rcon:rcon
WORKDIR /home/rcon
ENTRYPOINT ["/bin/sh"]
"""
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate (
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true,
alpine: true
)
){
node (label) {
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/rcon:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
functions.deletePod(
kubeAuth: "rancher-admin-token",
kubeURL: "https://k8s.test-chamber-13.lan:8043",
namespace: "game-servers",
selector: "app=rcon"
)
}
}