pipeline {
  agent {
    label 'pi501.in.thelinuxpro.net'
  }

  stages {
    stage("verify tooling") {
      steps {
	sh '''
        docker version
	docker info
        docker compose version
        '''
      }
    }

    stage("Build Containers and push to registry") {
      steps {
	script {
	  sh 'docker build -t docker-registry1.in.thelinuxpro.net:5000/sites/kameronkenny.com:0.0.3 . --push'
	}
      }
    }

    stage("Tag image as latest") {
      steps {
        script {
          sh 'docker tag docker-registry1.in.thelinuxpro.net:5000/sites/kameronkenny.com:0.0.3 docker-registry1.in.thelinuxpro.net:5000/sites/kameronkenny.com:latest'
        }
      }
    }

    stage("push latest tag") {
      steps {
        script {
          sh 'docker image push docker-registry1.in.thelinuxpro.net:5000/sites/kameronkenny.com:latest'
        }
      }
    }
    stage("Start web1 container") {
      steps {
        sh 'docker compose up -d --no-color'
      }
    }
  }
}

