diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e26f5b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Dockerfile for 'Are We Buried?' +FROM python:3.12-slim + +# Set environment +ENV PYTHONUNBUFFERED=1 +WORKDIR /app + +# Install dependencies +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application code +COPY . /app + +# Expose the Flask port +EXPOSE 5000 + +# Run the Flask app +CMD ["python", "app.py"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..722a1c7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,54 @@ +pipeline { + agent any + + environment { + REGISTRY = "gitea.thewrightserver.net" + IMAGE = "gitea.thewrightserver.net/josh/areweburied" + 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" + } + } +}