From e7d32152d5bba31d981e80e969b7b993c6df9753 Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 11 Jan 2026 22:06:41 -0500 Subject: [PATCH] adds ci cd --- Dockerfile | 14 +++++++++++++ Jenkinsfile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ 3 files changed, 70 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..78e2adc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app.py . +COPY templates ./templates +COPY static ./static + +EXPOSE 5000 + +CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..83d3ce5 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,54 @@ +pipeline { + agent any + + environment { + REGISTRY = "gitea.yourdomain.com" + IMAGE = "gitea.yourdomain.com//work-week-progress" + TAG = "${env.BUILD_NUMBER}" + } + + stages { + stage("Checkout") { + steps { + checkout scm + } + } + + stage("Build Image") { + steps { + sh """ + docker build \ + -t ${IMAGE}:${TAG} \ + -t ${IMAGE}:latest \ + . + """ + } + } + + stage("Push Image") { + steps { + withCredentials([ + usernamePassword( + credentialsId: 'gitea-registry-creds', + usernameVariable: 'GITEA_USER', + passwordVariable: 'GITEA_TOKEN' + ) + ]) { + sh """ + echo "$GITEA_TOKEN" | docker login ${REGISTRY} \ + -u "$GITEA_USER" --password-stdin + + docker push ${IMAGE}:${TAG} + docker push ${IMAGE}:latest + """ + } + } + } + } + + post { + cleanup { + sh "docker image prune -f" + } + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e4a286c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flask +gunicorn