add dockerfile and jenkinsfile
This commit is contained in:
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -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"]
|
||||||
54
Jenkinsfile
vendored
Normal file
54
Jenkinsfile
vendored
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user