Skip to content

Commit

Permalink
Add images with both "host" and "target" crossroots in one image. (#913)
Browse files Browse the repository at this point in the history
This is required in some cases - e.g. compiling node.js for ARM64/Alpine, and the ever-broken ARM64 runtime perf lane (where we need headers for ARM64 available alongside linkable libraries for AMD64, depending on the build phase).

As is, we've achieved the same result largely by accident in the pre-Mariner build images, where we have enough x64 in the host OS to link successfully, and the ARM64 files in the crossroot.

The precedent on this is #901 which fixed our Android cross-compiler builds, by offering both Android and $HOST in the same system

If at some point in the future we move from building on x64 to building on ARM64, we will need the equivalent images for that.

Co-authored-by: Matt Thalman <[email protected]>
  • Loading branch information
directhex and mthalman authored Aug 21, 2023
1 parent 34f91b1 commit 3643cf3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/cbl-mariner/2.0/cross/biarch/amd64-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-alpine-local AS crossrootbiarch

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-local

# Copy crossrootfs from Alpine build image, so we can build and cross-compile
# cross compilers within the same build system (e.g. required for Node.js)
COPY --from=crossrootbiarch /crossrootfs/x64 /crossrootfs/x64-alpine
7 changes: 7 additions & 0 deletions src/cbl-mariner/2.0/cross/biarch/arm64-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine-local AS crossrootbiarch

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-local

# Copy crossrootfs from Alpine build image, so we can build and cross-compile
# cross compilers within the same build system (e.g. required for Node.js)
COPY --from=crossrootbiarch /crossrootfs/arm64 /crossrootfs/arm64-alpine
7 changes: 7 additions & 0 deletions src/cbl-mariner/2.0/cross/biarch/arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-local AS crossrootbiarch

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-local

# Copy crossrootfs from ARM64 build image, so we can build and cross-compile
# cross compilers within the same build system (e.g. required for Node.js)
COPY --from=crossrootbiarch /crossrootfs/arm64 /crossrootfs/arm64
54 changes: 51 additions & 3 deletions src/cbl-mariner/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-amd64-alpine-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-amd64-alpine$(FloatingTagSuffix)": {}
"cbl-mariner-2.0-cross-amd64-alpine$(FloatingTagSuffix)": {},
"cbl-mariner-2.0-cross-amd64-alpine-local": {
"isLocal": true
}
}
}
]
Expand Down Expand Up @@ -153,7 +156,10 @@
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-arm64-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-arm64$(FloatingTagSuffix)": {}
"cbl-mariner-2.0-cross-arm64$(FloatingTagSuffix)": {},
"cbl-mariner-2.0-cross-arm64-local": {
"isLocal": true
}
}
}
]
Expand All @@ -166,7 +172,10 @@
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-arm64-alpine-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-arm64-alpine$(FloatingTagSuffix)": {}
"cbl-mariner-2.0-cross-arm64-alpine$(FloatingTagSuffix)": {},
"cbl-mariner-2.0-cross-arm64-alpine-local": {
"isLocal": true
}
}
}
]
Expand Down Expand Up @@ -318,6 +327,45 @@
}
]
},
{
"platforms": [
{
"dockerfile": "src/cbl-mariner/2.0/cross/biarch/arm64",
"os": "linux",
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-biarch-amd64-arm64-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-biarch-amd64-arm64$(FloatingTagSuffix)": {}
}
}
]
},
{
"platforms": [
{
"dockerfile": "src/cbl-mariner/2.0/cross/biarch/arm64-alpine",
"os": "linux",
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-biarch-amd64-arm64-alpine-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-biarch-amd64-arm64-alpine$(FloatingTagSuffix)": {}
}
}
]
},
{
"platforms": [
{
"dockerfile": "src/cbl-mariner/2.0/cross/biarch/amd64-alpine",
"os": "linux",
"osVersion": "cbl-mariner2.0",
"tags": {
"cbl-mariner-2.0-cross-biarch-amd64-amd64-alpine-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"cbl-mariner-2.0-cross-biarch-amd64-amd64-alpine$(FloatingTagSuffix)": {}
}
}
]
},
{
"platforms": [
{
Expand Down

0 comments on commit 3643cf3

Please sign in to comment.