adds image creation for doh-server
This commit is contained in:
parent
a87a6ff79b
commit
64019b5efe
80
build-doh-server.jenkins
Normal file
80
build-doh-server.jenkins
Normal file
@ -0,0 +1,80 @@
|
||||
def label = "${UUID.randomUUID().toString()}"
|
||||
def app_name = "dohserver"
|
||||
|
||||
def dockerfile = """
|
||||
FROM golang:alpine AS BUILDER
|
||||
RUN apk --no-cache add git upx && \\
|
||||
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 install -v /go/src/github.com/m13253/dns-over-https/doh-server/... && \\
|
||||
go build -ldflags="-s -w" -o /go/${app_name} /go/src/github.com/m13253/dns-over-https/doh-server/ && \\
|
||||
upx --brute /go/${app_name} && \\
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache ca-certificates && \\
|
||||
addgroup -S -g 1000 app && \\
|
||||
adduser -S app -G app -h /app -u 1000 && \\
|
||||
printf '%s\\n' \\
|
||||
"-----BEGIN CERTIFICATE-----" \\
|
||||
"MIICLTCCAbOgAwIBAgIDAYagMAoGCCqGSM49BAMEME0xCzAJBgNVBAYTAlVTMScw" \\
|
||||
"JQYDVQQKDB5UZXN0IENoYW1iZXIgMTMgVHJ1c3QgU2VydmljZXMxFTATBgNVBAMM" \\
|
||||
"DFRDMTMgUm9vdCBSMTAgFw0xOTAxMDEwMDAwMDBaGA8yMDUwMDEwMTAwMDAwMFow" \\
|
||||
"TTELMAkGA1UEBhMCVVMxJzAlBgNVBAoMHlRlc3QgQ2hhbWJlciAxMyBUcnVzdCBT" \\
|
||||
"ZXJ2aWNlczEVMBMGA1UEAwwMVEMxMyBSb290IFIxMHYwEAYHKoZIzj0CAQYFK4EE" \\
|
||||
"ACIDYgAE8+/J1ECc0VHxTtGXFLnHJ3NGZ2SW38pp9wI58L5EQbHRLiezYuvkUbI/" \\
|
||||
"XGJjLnFdpgjo7W1FFlyhx5ITlCstUX5Sn9bLZiA0+mE0n6b8VwhXwkHlnIeRo7od" \\
|
||||
"Zu/OfSFjo2MwYTAdBgNVHQ4EFgQUrGqUJhyRp93wXF645VNtYatRk/AwHwYDVR0j" \\
|
||||
"BBgwFoAUrGqUJhyRp93wXF645VNtYatRk/AwDwYDVR0TAQH/BAUwAwEB/zAOBgNV" \\
|
||||
"HQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwQDaAAwZQIxAJdgskimDJkf/MGVRrKotmNC" \\
|
||||
"xdH/UVQfQppjIR9FAiGeFDr47thclYrzIL6yCkV7nwIwYjf3MbOm/yWblzqe3Uyw" \\
|
||||
"UOemMEg3PjcKNsN65W2WVon5HIZx2XVfGRPjf5ZTVWzZ" \\
|
||||
"-----END CERTIFICATE-----" > /usr/local/share/ca-certificates/test-chamber-13.lan.crt && \\
|
||||
update-ca-certificates
|
||||
|
||||
USER app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=BUILDER /go/${app_name} /app/
|
||||
|
||||
ENTRYPOINT ./${app_name}
|
||||
"""
|
||||
|
||||
podTemplate(
|
||||
label: label,
|
||||
name: "pipeline-runner",
|
||||
yaml: """---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: golang
|
||||
image: docker.io/golang:latest
|
||||
tty: true
|
||||
command:
|
||||
- cat
|
||||
- name: kaniko
|
||||
imagePullPolicy: Always
|
||||
image: gcr.io/kaniko-project/executor:debug
|
||||
tty: true
|
||||
command:
|
||||
- /busybox/cat
|
||||
""",
|
||||
) {
|
||||
node (label) {
|
||||
def workspace = pwd()
|
||||
container('kaniko') {
|
||||
stage('Build Container') {
|
||||
writeFile file: workspace + '/Dockerfile', text: dockerfile
|
||||
sh """
|
||||
/kaniko/executor \\
|
||||
--insecure \\
|
||||
--skip-tls-verify \\
|
||||
--context "${workspace}" \\
|
||||
-f "${workspace}/Dockerfile" \\
|
||||
--destination "registry.test-chamber-13.lan:5000/${app_name}:latest"
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user