pipeline { agent any stages { stage('Lint & Build') { steps { script { dir('project2') { sh "docker build -t quotes-app ." // Linting simplu sh "docker run --rm quotes-app python -m py_compile famousquotes.py" } } } } stage('Run App') { steps { script { dir('project2') { // Folosim --network host și un DNS public pentru a forța ieșirea la internet sh "docker run --rm --network host --dns 8.8.8.8 -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app" } } } } } post { always { script { def discordUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjJjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJWK38mqa" def status = currentBuild.result ?: 'SUCCESS' sh """ curl -X POST -H 'Content-Type: application/json' \ -d '{"content": "🚀 Build #${env.BUILD_NUMBER} s-a terminat cu status: ${status}"}' \ '${discordUrl}' """ } } } }