diff --git a/src/dev/build/tasks/os_packages/docker_generator/run.ts b/src/dev/build/tasks/os_packages/docker_generator/run.ts index 332605e926537..82c29bf8d0361 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/run.ts +++ b/src/dev/build/tasks/os_packages/docker_generator/run.ts @@ -63,9 +63,9 @@ export async function runDockerGenerator( const dockerBuildDate = flags.dockerBuildDate || new Date().toISOString(); // That would produce oss, default and default-ubi7 const dockerBuildDir = config.resolveFromRepo('build', 'kibana-docker', `default${imageFlavor}`); - const imageArchitecture = flags.architecture === 'aarch64' ? '-aarch64' : ''; + const imageArchitecture = flags.architecture === 'aarch64' ? 'arm64' : 'amd64'; const dockerTargetFilename = config.resolveFromTarget( - `kibana${imageFlavor}-${version}-docker-image${imageArchitecture}.tar.gz` + `kibana${imageFlavor}-${version}-docker-image-${imageArchitecture}.tar.gz` ); const dependencies = [ resolve(artifactsDir, artifactTarball), @@ -104,16 +104,6 @@ export async function runDockerGenerator( publicArtifactSubdomain, }; - type HostArchitectureToDocker = Record; - const hostTarget: HostArchitectureToDocker = { - x64: 'x64', - arm64: 'aarch64', - }; - const buildArchitectureSupported = hostTarget[process.arch] === flags.architecture; - if (flags.architecture && !buildArchitectureSupported) { - return; - } - // Create the docker build target folder await mkdirp(dockerBuildDir); diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.ts b/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.ts index de26705566585..df5d39b85d806 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.ts +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.ts @@ -23,6 +23,7 @@ function generator({ const dockerTargetName = `${imageTag}${imageFlavor}:${version}${ dockerTagQualifier ? '-' + dockerTagQualifier : '' }`; + const dockerArchitecutre = architecture === 'aarch64' ? 'linux/arm64' : 'linux/amd64'; return dedent(` #!/usr/bin/env bash # @@ -59,7 +60,7 @@ function generator({ retry_docker_pull ${baseOSImage} echo "Building: kibana${imageFlavor}-docker"; \\ - docker build -t ${dockerTargetName} -f Dockerfile . || exit 1; + docker buildx build --platform ${dockerArchitecutre} -t ${dockerTargetName} -f Dockerfile . || exit 1; docker save ${dockerTargetName} | gzip -c > ${dockerTargetFilename}