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:
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@@ -19,21 +19,22 @@ pipeline {
|
|||||||
stage('Build Image') {
|
stage('Build Image') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// Ensure the buildkit socket directory exists and is writable
|
// 1. Create the directories just in case
|
||||||
sh "mkdir -p /run/buildkit && chmod 777 /run/buildkit"
|
sh "mkdir -p /run/buildkit /run/buildkit-default"
|
||||||
|
sh "chmod 777 /run/buildkit /run/buildkit-default"
|
||||||
// Start buildkitd if it is not already running
|
|
||||||
|
// 2. Start buildkitd with the SPECIFIC socket name nerdctl is looking for
|
||||||
sh """
|
sh """
|
||||||
if ! pgrep buildkitd > /dev/null; then
|
if ! pgrep buildkitd > /dev/null; then
|
||||||
echo "Starting buildkitd daemon..."
|
echo "Starting buildkitd on the default socket..."
|
||||||
# Start as root via sudo since it needs to manage network/mounts
|
buildkitd --addr unix:///run/buildkit/buildkitd.sock --addr unix:///run/buildkit-default/buildkitd.sock > /tmp/buildkitd.log 2>&1 &
|
||||||
nohup buildkitd --addr unix:///run/buildkit/buildkitd.sock > /tmp/buildkitd.log 2>&1 &
|
sleep 15
|
||||||
sleep 10
|
|
||||||
fi
|
fi
|
||||||
"""
|
"""
|
||||||
|
|
||||||
// Run the build using the aliased docker (nerdctl) command
|
// 3. Set the environment variable for this specific command
|
||||||
sh "docker build -t ${IMAGE_TAG} ."
|
// This tells the nerdctl/docker wrapper exactly where to look.
|
||||||
|
sh "export BUILDKIT_HOST=unix:///run/buildkit/buildkitd.sock && docker build -t ${IMAGE_TAG} ."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user