From ed1a35b7ec64cf5e119a73868ceb81777bdc14d1 Mon Sep 17 00:00:00 2001 From: jenkins-x-bot Date: Mon, 14 Sep 2020 13:59:37 +0800 Subject: [PATCH] Initial commit --- Dockerfile | 26 ++++++++++++++++++++++++++ Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b2afd7c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Base on latest (edge) alpine image +FROM harbor.ervine.dev/public/x86_64/alpine:v3.12 +LABEL MAINTAINER="Jonathan Ervine " + +# Install updates +ENV LANG='en_US.UTF-8' \ + LANGUAGE='en_US.UTF-8' \ + FLASK_APP=/data/app-dev/app.py + +RUN apk update && \ + apk -U upgrade --ignore alpine-baselayout && \ + apk -U add python3 gcc py3-pip python3-dev musl-dev libffi-dev git curl && \ + adduser -D python && \ + mkdir /data && cd /data && git clone --single-branch --branch master https://git.ervine.org/jonny/flask-python-helm2 /data && \ + pip3 install -r /data/requirements.txt && \ + curl -L "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl && \ + chmod 755 /usr/local/bin/kubectl && \ + curl -L https://get.helm.sh/helm-v2.13.1-linux-amd64.tar.gz -o /tmp/helm-2.13.1.tgz && \ + tar -zxvf /tmp/helm-2.13.1.tgz --strip-components=1 -C /usr/local/bin linux-amd64/helm && \ + rm -rf /tmp/src && rm -rf /var/cache/apk/* + +EXPOSE 3000 + +#USER python + +CMD [ "/usr/bin/python3", "/data/main.py" ] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4a400a7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,38 @@ +podTemplate(yaml: """ +kind: Pod +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251 + imagePullPolicy: Always + command: + - /busybox/cat + tty: true + volumeMounts: + - name: jenkins-docker-cfg + mountPath: /kaniko/.docker + volumes: + - name: jenkins-docker-cfg + projected: + sources: + - secret: + name: regcred + items: + - key: .dockerconfigjson + path: config.json +""" + ) { + + node(POD_LABEL) { + stage('Build with Kaniko') { + git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-helm2-python.git', credentialsId: 'jenkins-to-git' + container('kaniko') { + sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/public/x86_64/alpine/helm-2.13.1:v3.12.0 --destination=harbor.ervine.dev/public/x86_64/alpine/helm-2.13.1:v3.12' + } + } + } +} + +stage('Notify gchat') { + hangoutsNotify message: "Helm 2.13.1 python flask Application on Alpine Linux 3.12.0 has built",token: "A2ET831pVslqXTqAx6ycu573r",threadByJob: false +}