Update Jenkinsfile
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
This commit is contained in:
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
@@ -19,22 +19,12 @@ pipeline {
|
||||
stage('Build Image') {
|
||||
steps {
|
||||
script {
|
||||
// 1. Create the directories just in case
|
||||
sh "mkdir -p /run/buildkit /run/buildkit-default"
|
||||
sh "chmod 777 /run/buildkit /run/buildkit-default"
|
||||
// We call nerdctl directly, bypassing the 'docker' wrapper script.
|
||||
// This uses the containerd socket that your deployment YAML confirmed is at /run/containerd-pod/containerd.sock
|
||||
sh "nerdctl --address /run/containerd-pod/containerd.sock build -t ${IMAGE_TAG} ."
|
||||
|
||||
// 2. Start buildkitd with the SPECIFIC socket name nerdctl is looking for
|
||||
sh """
|
||||
if ! pgrep buildkitd > /dev/null; then
|
||||
echo "Starting buildkitd on the default socket..."
|
||||
buildkitd --addr unix:///run/buildkit/buildkitd.sock --addr unix:///run/buildkit-default/buildkitd.sock > /tmp/buildkitd.log 2>&1 &
|
||||
sleep 15
|
||||
fi
|
||||
"""
|
||||
|
||||
// 3. Set the environment variable for this specific command
|
||||
// This tells the nerdctl/docker wrapper exactly where to look.
|
||||
sh "export BUILDKIT_HOST=unix:///run/buildkit/buildkitd.sock && docker build -t ${IMAGE_TAG} ."
|
||||
// Tag it as latest for the local cache as well
|
||||
sh "nerdctl --address /run/containerd-pod/containerd.sock tag ${IMAGE_TAG} ${IMAGE_NAME}:latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user