stx-init-env: require minimal docker BuildKit
An earlier commit [1] introduced a feature (--build-context) that didn't
exist in older versions of docker. Make sure to use BuildKit (ie "docker
buildx") and require a minimal Dockerfile syntax version.
These features became part of docker around mid-2022.
Docker features and version history:
* BuildKit ("docker buildx") first introduced in Docker Engine 18.06.0
[https://docs.docker.com/engine/release-notes/18.06/#180600-ce].
* --build-context first appeared in BuildKit 0.8.0 / Docker Engine
20.10.13
[https://docs.docker.com/build/release-notes/#080]
[https://docs.docker.com/engine/release-notes/20.10/#201013]
* BuildKit became default on Linux: Docker Engine 23.0.0
[https://docs.docker.com/engine/release-notes/23.0/#new]
* Named contexts can be used in COPY --from in Dockerfile 1.4
[https://docs.docker.com/build/buildkit/dockerfile-release-notes/#140]
TESTS
=============
* Minikube (includes docker):
- v1.37.0 released 2025-09-09
* Docker Engine:
- 27.5.1 released 2025-01-22
- 29.0.4 released 2025-11-24
[1] https://review.opendev.org/c/starlingx/tools/+/968507
Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Ie73b188a185618b8856baf658dc7f85488408066
This commit is contained in:
@@ -90,6 +90,8 @@ STX_START_OPTS=
|
||||
# It doesn't need to track the build target (e.g. bullseye/trixie)
|
||||
COREUTILS_DOCKER_IMAGE="debian:bookworm-20240130-slim"
|
||||
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
info() {
|
||||
local tty_on tty_off
|
||||
if [[ -t 2 ]] ; then
|
||||
@@ -1002,7 +1004,7 @@ if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
|
||||
info "Starting to build image: $img:$DOCKER_TAG_LOCAL-${builder_os_codename}"
|
||||
|
||||
# Build command base
|
||||
cmd="docker build ${docker_build_args[@]} ${extra_build_args[@]}"
|
||||
cmd="docker buildx build ${docker_build_args[@]} ${extra_build_args[@]}"
|
||||
|
||||
# Add dedicated build context ONLY for stx-lat-tool (regardless of cache status)
|
||||
# We always pass --build-context (even if empty) to keep Dockerfile compatible
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# Copyright (c) 2021,2025 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
Reference in New Issue
Block a user