I'm new to Jenkins, and I have a project, but there are I need few instances of it, with different configurations, meaning, to run different docker-compose files, due to different mounts / ports, but the rest of the project is the same.
I could not find any information about an issue like this.
if it help: Jenkinsfile:
pipeline {
agent any
environment {
PATH = "$PATH:/usr/local/bin"
}
stages {
stage("build docker image"){
steps{
sh """
docker build . -t application:development --pull=false
"""
}
}
stage("run compose"){
steps{
sh"""
docker-compose up -d
"""
}
}
}
CodePudding user response:
Yes! This is possible.
You need to create 2 docker-compose files with different configurations.
Ex:
docker-compose-a.yml
docker-compose-b.yml
Then:
pipeline {
agent any
environment {
PATH = "$PATH:/usr/local/bin"
}
stages {
stage("build docker image"){
steps{
sh """
docker build . -t application:development --pull=false
"""
}
}
stage("run compose"){
steps{
sh"""
docker-compose up -f docker-compose-a.yml -d
docker-compose up -f docker-compose-b.yml -d
"""
}
}
}
