diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..46db763 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Base on latest (edge) alpine image +FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11 + +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 && \ + apk -U add python3 gcc py3-pip python3-dev musl-dev libffi-dev git && \ + adduser -D python + +RUN mkdir /data && cd /data && git clone --single-branch --branch dev https://git.ervine.org/jonny/gcp-hockey-results /data + +RUN pip3 install -r /data/requirements.txt + +RUN 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..faff5a5 --- /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-hockey", 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/hockey" + + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("latest") + + stage('Deploy on K8s'){ + sh "/usr/local/bin/kubectl -n dev delete po --all" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a051d66 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,26 @@ +attrs==17.4.0 +bcrypt==3.1.4 +cffi==1.11.4 +click==6.7 +Flask==0.12.2 +Flask-BasicAuth +Flask-Bootstrap +Flask-Bcrypt==0.7.1 +Flask-Login==0.4.1 +Flask-SQLAlchemy==2.3.2 +Flask-WTF==0.14.2 +itsdangerous==0.24 +Jinja2==2.10 +MarkupSafe==1.0 +pluggy==0.6.0 +py==1.5.2 +pycparser==2.18 +pymysql +pytest==3.4.1 +six==1.11.0 +Werkzeug==0.14.1 +WTForms==2.1 +WTForms-Components +pymysql_sa +Flask-pymysql +flask_table