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/build-icecast.jenkins

74 lines
2.2 KiB
Groovy

#!groovy
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def workspace
def dockerFile
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
pipeline {
agent {
kubernetes {
yaml functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true
)
}
}
stages {
stage ('Initalize Jenkins') {
steps {
script {
workspace = pwd()
dockerFile = """FROM ${repository}/dockerhub/library/alpine:latest
LABEL org.opencontainers.image.authors="The_Spider <spider@smoothnet.org>"
LABEL org.opencontainers.image.title="icecast"
LABEL org.opencontainers.image.description="Docker Container providing services for IceCast"
LABEL org.opencontainers.image.base.name="docker.io/library/alpine/latest"
ENV CONFIG_FILE="/etc/icecast.xml"
RUN apk add --no-cache icecast curl && \\
mkdir /icecast && \\
chown icecast:icecast /icecast
USER icecast
CMD ["/bin/sh", "-c", "icecast -c \\"\${CONFIG_FILE}\\""]
"""
}
}
}
stage ('Build & Push') {
steps {
container ('kaniko') {
script {
declarativeFunctions.buildContainerMultipleDestinations(
dockerFile: dockerFile,
repositoryAccess: [
[
repository: repository,
credentials: repositoryCreds
],
[
repository: "registry.hub.docker.com",
credentials: "dockerhub-repository-creds"
],
],
destination: [
"${repository}/library/icecast:latest",
"registry.hub.docker.com/thespider/icecast:latest",
]
)
}
}
}
}
}
}