Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack: fix dev-shell script #136

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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"
]
}
2 changes: 1 addition & 1 deletion hack/dev-shell
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./

Expand Down
Loading