125 lines
3.7 KiB
Plaintext
125 lines
3.7 KiB
Plaintext
def ImageRepository = "registry.test-chamber-13.lan:5000"
|
|
def ImageName = "factorio"
|
|
def ImageTag = "latest"
|
|
|
|
def AlpineGlibcBaseURL = "https://github.com/sgerrand/alpine-pkg-glibc/releases/download"
|
|
def AlpineGlibcPackageVersion = "2.30-r0"
|
|
def AlpineGlibcBasePackageFilename = "glibc-${AlpineGlibcPackageVersion}.apk"
|
|
def AlpineGlibcBinPackageFilename = "glibc-${AlpineGlibcPackageVersion}.apk"
|
|
def AlpineGlibcI18nPackageFilename = "glibc-${AlpineGlibcPackageVersion}.apk"
|
|
|
|
def GlibcLanguage = "C.UTF-8"
|
|
|
|
def TimeZone = "America/Chicago"
|
|
|
|
def FactorioDownloadURL = "https://www.factorio.com/get-download/stable/headless/linux64"
|
|
def FactorioFileName = "/tmp/factorio.tar"
|
|
|
|
def dockerFile = """
|
|
FROM alpine:3.10
|
|
|
|
MAINTAINER The_Spider <spider@smoothnet.org>
|
|
|
|
RUN \\
|
|
apk add --update --no-cache \\
|
|
pwgen \\
|
|
su-exec \\
|
|
binutils \\
|
|
gettext \\
|
|
libintl \\
|
|
shadow && \\
|
|
apk add --update --no-cache --virtual=.build-dependencies \\
|
|
curl \\
|
|
ca-certificates && \\
|
|
printf '%s\\n' \\
|
|
"-----BEGIN PUBLIC KEY-----" \\
|
|
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m" \\
|
|
"y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu" \\
|
|
"tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp" \\
|
|
"m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY" \\
|
|
"KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc" \\
|
|
"Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m" \\
|
|
"1QIDAQAB" \\
|
|
"-----END PUBLIC KEY-----" > "/etc/apk/keys/sgerrand.rsa.pub" && \\
|
|
curl -sSLO "${AlpineGlibcBaseURL}/${AlpineGlibcPackageVersion}/${AlpineGlibcBasePackageFilename}" && \\
|
|
curl -sSLO "${AlpineGlibcBaseURL}/${AlpineGlibcPackageVersion}/${AlpineGlibcBinPackageFilename}" && \\
|
|
curl -sSLO "${AlpineGlibcBaseURL}/${AlpineGlibcPackageVersion}/${AlpineGlibcI18nPackageFilename}" && \\
|
|
apk add --no-cache \\
|
|
"${AlpineGlibcBasePackageFilename}" \\
|
|
"${AlpineGlibcBinPackageFilename}" \\
|
|
"${AlpineGlibcI18nPackageFilename}" && \\
|
|
rm -v "/etc/apk/keys/sgerrand.rsa.pub" && \\
|
|
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "${GlibcLanguage}" || true && \\
|
|
printf '%s\\n' \\
|
|
"export LANG=${GlibcLanguage}" \\
|
|
"export TZ=${TimeZone}" >> /etc/profile.d/locale.sh && \\
|
|
mkdir -p /opt /factorio && \\
|
|
curl -sSL "${FactorioDownloadURL}" -o ${FactorioFileName} && \\
|
|
tar -x -f ${FactorioFileName} --directory /opt && \\
|
|
apk del glibc-i18n && \\
|
|
apk del .build-dependencies && \\
|
|
rm -v \\
|
|
"${AlpineGlibcBasePackageFilename}" \\
|
|
"${AlpineGlibcBinPackageFilename}" \\
|
|
"${AlpineGlibcI18nPackageFilename}" \\
|
|
${FactorioFileName} && \\
|
|
addgroup -g 1000 -S factorio && \\
|
|
adduser -u 1000 -G factorio -s /bin/sh -SDH factorio && \\
|
|
chown -R factorio:factorio /opt/factorio /factorio
|
|
"""
|
|
|
|
podTemplate(
|
|
containers: [
|
|
containerTemplate(
|
|
name: "docker",
|
|
image: "docker:19.03",
|
|
command: "sleep",
|
|
args: "99d",
|
|
envVars: [
|
|
envVar(
|
|
key: "DOCKER_HOST",
|
|
value: "tcp://localhost:2375"
|
|
)
|
|
]
|
|
),
|
|
containerTemplate(
|
|
name: "docker-daemon",
|
|
image: "docker:19.03-dind",
|
|
command: "dockerd-entrypoint.sh",
|
|
args: "--insecure-registry registry.test-chamber-13.lan:5000",
|
|
privileged: true,
|
|
envVars: [
|
|
envVar(
|
|
key: "DOCKER_TLS_CERTDIR",
|
|
value: ""
|
|
)
|
|
],
|
|
)
|
|
]
|
|
) {
|
|
node(POD_LABEL) {
|
|
container("docker") {
|
|
stage("Test DinD Daemon") {
|
|
sh """
|
|
docker version
|
|
"""
|
|
}
|
|
stage("Write Dockerfile"){
|
|
writeFile(file: "Dockerfile", text: dockerFile)
|
|
sh """
|
|
cat Dockerfile
|
|
"""
|
|
}
|
|
stage("Build Container"){
|
|
sh """
|
|
docker build --tag ${ImageRepository}/${ImageName}:${ImageTag} ./
|
|
"""
|
|
}
|
|
stage("Push Container"){
|
|
sh """
|
|
docker push ${ImageRepository}/${ImageName}:${ImageTag}
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
} |