diff --git a/platform/Dockerfile b/platform/Dockerfile new file mode 100644 index 0000000..6fa328a --- /dev/null +++ b/platform/Dockerfile @@ -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"] \ No newline at end of file diff --git a/platform/Jenkinsfile b/platform/Jenkinsfile new file mode 100644 index 0000000..91899a5 --- /dev/null +++ b/platform/Jenkinsfile @@ -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' + } + } +} \ No newline at end of file diff --git a/platform/sonar-project.properties b/platform/sonar-project.properties new file mode 100644 index 0000000..328b6ee --- /dev/null +++ b/platform/sonar-project.properties @@ -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 \ No newline at end of file