Advertisement
QualibreInfo

python docker

Jun 2nd, 2023
1,938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.05 KB | None | 0 0
  1. pipeline {
  2.     agent any
  3.     environment {
  4.         AUTHOR = 'Guillaume Rémy'
  5.         PURPOSE    = 'This is a sample app'
  6.         LIFE_QUOTE = 'The greatest glory in living lies not in never falling, but in rising every time we fall.'
  7.     }
  8.     stages {
  9.         stage('Checkout') {
  10.             steps {
  11.                 // Checkout your source code repository
  12.                 git branch: 'main',
  13.                     url: 'https://gitlab.com/qualibre-info-formations/public/python-django-simple.git'
  14.             }
  15.         }
  16.         stage('Build') {
  17.             steps {
  18.                 // Build your Django application
  19.                 sh 'docker build -t django-simple-app .'
  20.             }
  21.         }
  22.         stage('Deploy') {
  23.             steps {
  24.                 // Deploy your Django application
  25.                 sh 'docker rm -f django-sample-app || true'
  26.                 sh 'docker run --name django-sample-app -d -p 8000:8000 -it -e AUTHOR="$AUTHOR" -e PURPOSE="$PURPOSE" -e LIFE_QUOTE="$LIFE_QUOTE" django-simple-app'
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement