mirror of
https://github.com/imjasonh/krust
synced 2026-07-08 06:45:32 +00:00
feat: Expand platform support to match Alpine's supported architectures
- Add support for linux/386 (i686-unknown-linux-musl) - Add support for linux/arm/v6 (arm-unknown-linux-musleabihf) - Add support for linux/ppc64le (powerpc64le-unknown-linux-musl) - Add support for linux/s390x (s390x-unknown-linux-musl) - Add support for linux/riscv64 (riscv64gc-unknown-linux-musl) - Update platform detection to include all new platforms - Add tests for all new platform mappings - Update documentation with installation instructions for all targets - Add CI job to test extended platform support - Update development setup docs to mention cargo-zigbuild for full platform support This allows krust to build images for all platforms supported by Alpine Linux, making it more versatile for multi-architecture container deployments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2517939b30
commit
1f730645c3
5 changed files with 145 additions and 3 deletions
61
.github/workflows/ci.yml
vendored
61
.github/workflows/ci.yml
vendored
|
|
@ -166,6 +166,67 @@ jobs:
|
|||
# Run the image - should automatically select the right architecture
|
||||
docker run --rm $IMAGE_REF
|
||||
|
||||
# Test extended platform support
|
||||
extended-platforms:
|
||||
name: Extended Platform Support
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test] # Only run after basic tests pass
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-unknown-linux-musl,i686-unknown-linux-musl,aarch64-unknown-linux-musl,armv7-unknown-linux-musleabihf
|
||||
- name: Install cross-compilation tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y musl-tools gcc-multilib
|
||||
- name: Setup cargo config
|
||||
run: |
|
||||
mkdir -p .cargo
|
||||
cat > .cargo/config.toml << 'EOF'
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
linker = "x86_64-linux-musl-gcc"
|
||||
|
||||
[target.i686-unknown-linux-musl]
|
||||
linker = "musl-gcc"
|
||||
rustflags = ["-C", "target-cpu=i686"]
|
||||
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
|
||||
[target.armv7-unknown-linux-musleabihf]
|
||||
linker = "arm-linux-gnueabihf-gcc"
|
||||
EOF
|
||||
- name: Build krust
|
||||
run: cargo build --release
|
||||
- name: Test multi-platform build with Alpine base
|
||||
run: |
|
||||
# Create a test project that uses Alpine (which supports many platforms)
|
||||
mkdir -p test-alpine-platforms/src
|
||||
cat > test-alpine-platforms/Cargo.toml << 'EOF'
|
||||
[package]
|
||||
name = "test-alpine"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[package.metadata.krust]
|
||||
base-image = "alpine:latest"
|
||||
EOF
|
||||
cat > test-alpine-platforms/src/main.rs << 'EOF'
|
||||
fn main() {
|
||||
println!("Hello from Alpine multi-platform test!");
|
||||
}
|
||||
EOF
|
||||
|
||||
# Test that platform detection works (even if we can't build all platforms)
|
||||
cd test-alpine-platforms
|
||||
../target/release/krust build --no-push --image test.local/alpine-test:latest . 2>&1 | tee build.log
|
||||
|
||||
# Verify platform detection happened
|
||||
grep -q "Detecting available platforms from base image: alpine:latest" build.log
|
||||
grep -q "Found platforms:" build.log
|
||||
|
||||
# Takes too long to run on CI, so it's commented out for now.
|
||||
# coverage:
|
||||
# name: Code coverage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue