Add Dockerfile and Jenkinsfile

This commit is contained in:
2026-05-19 00:05:03 +01:00
parent 53f36d0ac7
commit 8fdf930ae9
3 changed files with 72 additions and 0 deletions

12
platform/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "app.py"]

54
platform/Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,54 @@
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo 'Code checked out'
}
}
stage('Install Dependencies') {
steps {
sh '''
cd platform
python3 -m venv venv
venv/bin/pip install -r requirements.txt --quiet
'''
}
}
stage('Test') {
steps {
sh '''
cd platform
echo "Running basic syntax check..."
venv/bin/python -m py_compile app.py && echo "✅ app.py syntax OK"
'''
}
}
stage('Deploy to Server 1') {
steps {
sh '''
cp -r platform/* /root/management-platform/
cd /root/management-platform
venv/bin/pip install -r requirements.txt --quiet 2>/dev/null || true
systemctl restart management-platform
sleep 4
systemctl is-active --quiet management-platform && echo "✅ Deployed OK" || exit 1
'''
}
}
}
post {
success {
echo '✅ Pipeline succeeded — platform deployed'
}
failure {
echo '❌ Pipeline failed — old version still running'
}
}
}

View File

@@ -0,0 +1,6 @@
sonar.projectKey=management-platform
sonar.projectName=Management Platform
sonar.projectVersion=1.0
sonar.sources=.
sonar.exclusions=**/__pycache__/**,**/venv/**,**/*.pyc
sonar.python.version=3