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\"" } } } }