Update 'build-doh-server.jenkins'

This commit is contained in:
Hyatt 2021-05-22 21:02:15 +00:00
parent 5d8eda5cfb
commit d7e3f32b7e

View File

@ -1,7 +1,7 @@
def nodeLabel = "${UUID.randomUUID().toString()}" def nodeLabel = "${UUID.randomUUID().toString()}"
def repository = "registry.test-chamber-13.lan" def repository = "registry.cluster.test-chamber-13.lan"
def kanikoImage = "${repository}/nhyatt/kaniko:latest" def kanikoImage = "${repository}/library/kaniko:latest"
def repositoryCreds = "quay-repository-creds" def repositoryCreds = "harbor-repository-creds"
podTemplate( podTemplate(
name: "pipelineContainer", name: "pipelineContainer",
@ -45,14 +45,14 @@ spec:
stage('Build Container') { stage('Build Container') {
container('kaniko') { container('kaniko') {
def dockerfile = """FROM golang:alpine AS BUILDER def dockerfile = """FROM ${repository}/dockerhub/library/golang:alpine AS BUILDER
RUN apk --no-cache add git upx && \\ RUN apk --no-cache add git upx && \\
go get github.com/m13253/dns-over-https/doh-server && \\ go get github.com/m13253/dns-over-https/doh-server && \\
go get -d -v /go/src/github.com/m13253/dns-over-https/doh-server/... && \\ go get -d -v /go/src/github.com/m13253/dns-over-https/doh-server/... && \\
go install -v /go/src/github.com/m13253/dns-over-https/doh-server/... && \\ go install -v /go/src/github.com/m13253/dns-over-https/doh-server/... && \\
go build -ldflags="-s -w" -o /go/dohserver /go/src/github.com/m13253/dns-over-https/doh-server/ && \\ go build -ldflags="-s -w" -o /go/dohserver /go/src/github.com/m13253/dns-over-https/doh-server/ && \\
upx --brute /go/dohserver upx --brute /go/dohserver
FROM ${repository}/nhyatt/alpine:latest FROM ${repository}/library/alpine:latest
RUN apk add --no-cache && \\ RUN apk add --no-cache && \\
addgroup -S -g 1000 app && \\ addgroup -S -g 1000 app && \\
adduser -S app -G app -h /app -u 1000 adduser -S app -G app -h /app -u 1000
@ -63,7 +63,7 @@ ENTRYPOINT ./dohserver
""" """
writeFile file: workspace + '/Dockerfile', text: dockerfile writeFile file: workspace + '/Dockerfile', text: dockerfile
sh "/kaniko/executor --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/nhyatt/dohserver:latest\"" sh "/kaniko/executor --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/dohserver:latest\""
} }
} }
} }