Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipeline {
- agent any
- environment {
- AUTHOR = 'Guillaume Rémy'
- PURPOSE = 'This is a sample Django app'
- LIFE_QUOTE = 'The greatest glory in living lies not in never falling, but in rising every time we fall.'
- }
- stages {
- stage('Checkout') {
- steps {
- // Checkout your source code repository
- git branch: 'main',
- url: 'https://gitlab.com/<username>/python-django-simple.git'
- }
- }
- stage('Setup') {
- steps {
- // Set up your virtual environment or any other dependencies
- sh 'python3 -m venv venv'
- }
- }
- stage('Install Dependencies') {
- steps {
- // Install required dependencies
- sh '. venv/bin/activate && pip3 install -r requirements.txt'
- }
- }
- stage('Test') {
- steps {
- // Run your Django tests
- sh '. venv/bin/activate && python3 manage.py test'
- }
- }
- stage('Build') {
- steps {
- // Build your Django application
- sh 'docker build -t django-simple-app .'
- }
- }
- stage('Deploy') {
- steps {
- // Deploy your Django application
- sh 'docker rm -f django-sample-app || true'
- sh 'docker run --name django-sample-app -d -p 8000:8000 -it -e AUTHOR -e PURPOSE -e LIFE_QUOTE django-simple-app'
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement