From d0c02ed5e3b448f23855c6793ce4e3a375818bcb Mon Sep 17 00:00:00 2001 From: Hyatt Date: Tue, 30 Nov 2021 15:49:11 +0000 Subject: [PATCH] Add 'build-vlmcsd.jenkins' --- build-vlmcsd.jenkins | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 build-vlmcsd.jenkins diff --git a/build-vlmcsd.jenkins b/build-vlmcsd.jenkins new file mode 100644 index 0000000..d005e0d --- /dev/null +++ b/build-vlmcsd.jenkins @@ -0,0 +1,67 @@ +def label = "jenkins-${UUID.randomUUID().toString()}" + +def repository = "registry.c.test-chamber-13.lan" +def kanikoImage = "${repository}/library/kaniko:latest" +def repositoryCreds = "harbor-repository-creds" + +podTemplate( + label: label, + name: "pipeline-worker", + yaml: """--- +apiVersion: v1 +kind: Pod +spec: + containers: + - name: kaniko + image: ${kanikoImage} + tty: true + command: + - /busybox/cat +""", +) { + node (label) { + def workspace = pwd() + + stage ("Prepare Kaniko") { + container ("kaniko") { + withCredentials([usernameColonPassword( + credentialsId: repositoryCreds, + variable: "dCreds", + )]) { + def dockerJSON = """{ + "auths": { + "${repository}": { + "auth": "${dcreds.bytes.encodeBase64().toString()}" + } + } + }""" + sh """ + set +x + echo '${dockerJSON}' > /kaniko/.docker/config.json + """ + } + } + } + + stage("Kaniko Build & Push") { + container ("kaniko") { + def dockerfile = """ +FROM ${repository}/dockerhub/cm2network/steamcmd:latest + +EXPOSE 15777/udp +EXPOSE 15000/udp +EXPOSE 777/udp + +RUN /home/steam/steamcmd/steamcmd.sh +quit && \\ + /home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/SatisfactoryDedicatedServer +login anonymous +app_update 1690800 validate +quit + +WORKDIR /home/steam/SatisfactoryDedicatedServer + +ENTRYPOINT ["/bin/bash" "-c" "./FactoryServer.sh -multihome=0.0.0.0"] +""" + writeFile (file: workspace + "/Dockerfile", text: dockerfile) + sh "/kaniko/executor --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/statafactory-server:latest\"" + } + } + } +} \ No newline at end of file