diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0e72354 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Base on latest (edge) alpine image +FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11 + +LABEL maintainer “Jonathan Ervine” architecture="x86_64" date="17022020" + +# Install updates +ENV LANG='en_US.UTF-8' \ + LANGUAGE='en_US.UTF-8' \ + TERM='xterm' \ + VERSION='master' + +RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ + apk update && \ + apk -U upgrade && \ + apk -U add \ + python \ + py-lxml \ + py-simplejson \ + openssl \ + py-openssl + +RUN wget https://github.com/CouchPotato/CouchPotatoServer/archive/$VERSION.tar.gz -O couchpotato.tar.gz && \ + tar zxvf couchpotato.tar.gz && \ + mv CouchPotatoServer-$VERSION couchpotato && \ + rm -rf couchpotato.tar.gz && \ + apk del make gcc g++ && \ + rm -rf /tmp/src && \ + rm -rf /var/cache/apk/* + +COPY start.sh /usr/local/bin/start.sh + +EXPOSE 5050 + + +CMD [ "/usr/local/bin/start.sh" ] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..1775b23 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +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-cp", credentialsId: 'jenkins-to-git' + + 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/couchpotato" + + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("latest") + + stage('Deploy on K8s'){ + sh "/usr/local/bin/kubectl -n media delete po cp-0 && kubectl -n media delete po cp-kids-0" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } + } +} diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..8a4ee8d --- /dev/null +++ b/start.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +## Script to kick off Couchpotato Movies media orgnaiser +# +addgroup -g $GID $USER +adduser -D -u $UID -G $USER -H $USER +chown -R $UID:$GID /couchpotato /config +su - $USER -c "/usr/bin/python2 /couchpotato/CouchPotato.py --console_log --data_dir=/config"