Skip to content

Commit

Permalink
Merge pull request #136 from tonistiigi/dev-shell
Browse files Browse the repository at this point in the history
hack: fix dev-shell script
  • Loading branch information
crazy-max authored Jan 5, 2024
2 parents 16d225b + e68ab24 commit 263a0bd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
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

0 comments on commit 263a0bd

Please sign in to comment.