hack: fix dev-shell script

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-01-04 20:20:21 -08:00
parent 16d225b4da
commit e68ab24bd8
3 changed files with 33 additions and 3 deletions

View File

@@ -6,6 +6,14 @@ variable "TEST_BASE_TYPE" {
default = "alpine"
}
variable "TEST_BASE_IMAGE" {
default = TEST_BASE_TYPE == "alpine" ? "alpine:3.19" : TEST_BASE_TYPE == "debian" ? "debian:bookworm" : null
}
variable "DEV_SDK_PLATFORM" {
default = null
}
// Special target: https://github.com/docker/metadata-action#bake-definition
target "meta-helper" {
tags = ["${XX_REPO}:test"]
@@ -169,6 +177,11 @@ target "sdk-extras" {
]
}
target "sdk-extras-dev" {
inherits = ["sdk-extras"]
platforms = DEV_SDK_PLATFORM == null ? null : [ DEV_SDK_PLATFORM ]
}
target "_ld-base" {
context = "src/ld"
contexts = {
@@ -310,3 +323,20 @@ target "libcxx" {
"linux/arm64",
]
}
target "dev" {
context = "src"
target = "dev"
contexts = {
"tonistiigi/xx" = "target:xx"
"sdk-extras" = DEV_SDK_PLATFORM != null ? "target:sdk-extras-dev" : "docker-image://scratch"
}
args = {
TEST_BASE_TYPE = TEST_BASE_TYPE
TEST_BASE_IMAGE = TEST_BASE_IMAGE
}
tags = [ "${XX_REPO}:dev" ]
output = [
"type=docker"
]
}

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env sh
docker buildx build --load -t tonistiigi/xx:dev --build-arg TEST_BASE_TYPE --build-arg TEST_BASE_IMAGE --build-arg TEST_WITH_DARWIN --target=dev ./base
docker buildx bake dev
if ! docker volume inspect xx-pkg-cache >/dev/null 2>&1; then
docker volume create xx-pkg-cache >/dev/null 2>&1

View File

@@ -101,8 +101,8 @@ FROM scratch AS sdk-extras
# dev can be used for debugging during development
FROM test-base AS dev
COPY --from=sdk-extras / /
COPY --from=xx / /
COPY --link --from=sdk-extras / /
COPY --link --from=xx / /
COPY fixtures fixtures
COPY *.bats test_helper.bash ./