From 060913c6ae818968837f03d9dbb020524330758f Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Thu, 9 Jul 2020 22:51:25 +0800 Subject: [PATCH] new file: Dockerfile new file: Jenkinsfile new file: UTC new file: start.sh --- Dockerfile | 27 +++++++++++++++++++++++++++ Jenkinsfile | 27 +++++++++++++++++++++++++++ UTC | Bin 0 -> 127 bytes start.sh | 8 ++++++++ 4 files changed, 62 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 UTC create mode 100755 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..90a16b8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Base on latest (edge) alpine image +FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11 + +MAINTAINER “Jonathan Ervine” + +# Install updates +# Create mediaservice user +ENV LANG='en_US.UTF-8' \ + LANGUAGE='en_US.UTF-8' \ + TERM='xterm' + +RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ + apk update && \ + apk -U upgrade && \ + apk -U add \ + python git py-pillow + +ADD UTC /etc/localtime + +RUN git clone https://github.com/Hellowlol/HTPC-Manager && \ + rm -rf /var/cache/apk/* + +COPY start.sh /usr/local/bin/start.sh + +EXPOSE 8085 + +CMD [ "/usr/local/bin/start.sh" ] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fe6bb81 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,27 @@ +node("docker-node") { + docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { + + git branch: "3.11.6", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-htpcmgr", credentialsId: 'jenkins-to-gogs' + + sh "git rev-parse HEAD > .git/commit-id" + def commit_id = readFile('.git/commit-id').trim() + println commit_id + + try { + + stage "build" + def app = docker.build "library/x86_64/alpine/htpc-mgr" + + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("latest") + + stage('Deploy on K8s'){ + sh "/usr/local/bin/kubectl -n media delete po htpc-0" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } + } +} diff --git a/UTC b/UTC new file mode 100644 index 0000000000000000000000000000000000000000..c3b97f1a199421d6d9625b280316d99b85a4a4e8 GIT binary patch literal 127 ucmWHE%1kq2zyORu5fFv}5Ss