workout/Jenkinsfile

27 lines
720 B
Text
Raw Normal View History

2018-05-03 10:11:30 +02:00
pipeline {
2018-05-03 11:02:59 +02:00
agent any
2018-05-03 10:11:30 +02:00
stages {
stage('Build') {
steps {
2018-05-03 11:09:54 +02:00
sh 'docker build --pull -t workout:jenkins .'
2018-05-03 10:11:30 +02:00
}
}
2018-05-03 11:26:19 +02:00
stage('test') {
steps {
2018-05-03 11:40:33 +02:00
sh 'docker container stop pg || true'
sh 'docker container stop workout || true'
sh 'docker network create test_workout'
sh 'docker container run --rm --name pg --network test_workout -d postgres'
sh 'docker container run --rm --name workout --network test_workout -p 8000:8000 -e DATABASE_URL=postgres://postgres:postgres@pg:5432/postgres -d workout:jenkins'
sh 'curl http://localhost:8000'
2018-05-03 11:26:19 +02:00
}
}
2018-05-03 10:11:30 +02:00
}
2018-05-03 11:29:05 +02:00
post {
always {
sh 'docker stop pg'
2018-05-03 11:40:33 +02:00
sh 'docker stop workout'
2018-05-03 11:29:05 +02:00
}
}
2018-05-03 11:02:34 +02:00
}