pipeline { agent none environment { HOME = "${env.WORKSPACE}" DOCKER_REGISTRY = 'https://registry.digitalocean.com' DOCKER_IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov' DOCKER_IMAGE = '' } stages { stage('Setup') { agent { docker { image 'python:3.10-slim-bullseye' } } steps { sh 'python -m pip install --no-cache-dir --upgrade --user pip' sh 'python -m pip install --no-cache-dir pipenv --user' sh 'python -m pipenv install --dev' } } stage('Check') { agent { docker { image 'python:3.10-slim-bullseye' } } steps { sh 'python -m pipenv verify' sh 'python -m pipenv check --clear' sh 'python -m pipenv run bandit *.py' } } stage('Build') { agent { label 'main' } steps { script { DOCKER_IMAGE = docker.build("${DOCKER_IMAGE_NAME}") } } } stage('Publish') { agent { label 'main' } when { branch 'main' } steps { script { docker.withRegistry(env.DOCKER_REGISTRY, 'digital-ocean-ailuridae-registry') { DOCKER_IMAGE.push("${BUILD_NUMBER}") DOCKER_IMAGE.push('latest') } } } } } post { always { node('main') { cleanWs() } } } }