diff --git a/Jenkinsfile b/Jenkinsfile index 4eaac19..347b7a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,7 @@ pipeline { // Build + deploy stages require Docker CLI/daemon access on the Jenkins node. // Ensure this label maps to an agent with Docker installed and usable. + //update agent any environment { @@ -12,8 +13,6 @@ pipeline { APP_USER = "${env.APP_USER ?: 'deploy'}" DEPLOY_PATH = "${env.DEPLOY_PATH ?: '/opt/plesk-agency-portal'}" APP_BASE_URL = "${env.APP_BASE_URL ?: 'http://192.168.68.89:3000'}" - NEXT_PUBLIC_SUPABASE_URL = "${env.NEXT_PUBLIC_SUPABASE_URL ?: ''}" - NEXT_PUBLIC_SUPABASE_ANON_KEY = "${env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?: ''}" } @@ -64,13 +63,23 @@ pipeline { stage('Build application') { steps { - sh 'npm run build' + withCredentials([ + string(credentialsId: 'supabase-public-url', variable: 'NEXT_PUBLIC_SUPABASE_URL'), + string(credentialsId: 'supabase-public-anon-key', variable: 'NEXT_PUBLIC_SUPABASE_ANON_KEY') + ]) { + sh 'npm run build' + } } } stage('Build Docker image') { steps { - sh 'docker build --build-arg NEXT_PUBLIC_SUPABASE_URL="${NEXT_PUBLIC_SUPABASE_URL}" --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY="${NEXT_PUBLIC_SUPABASE_ANON_KEY}" -t ${IMAGE_LATEST} -t ${IMAGE_BUILD} .' + withCredentials([ + string(credentialsId: 'supabase-public-url', variable: 'NEXT_PUBLIC_SUPABASE_URL'), + string(credentialsId: 'supabase-public-anon-key', variable: 'NEXT_PUBLIC_SUPABASE_ANON_KEY') + ]) { + sh 'docker build --build-arg NEXT_PUBLIC_SUPABASE_URL="$NEXT_PUBLIC_SUPABASE_URL" --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY="$NEXT_PUBLIC_SUPABASE_ANON_KEY" -t ${IMAGE_LATEST} -t ${IMAGE_BUILD} .' + } } }