fix: Alpine Rust toolchain compatibility

- Remove rustup dependency from Dockerfile (not available in Alpine)
- Update Rust environment setup to handle both rustup and system Rust
- Fix musl-gcc linker configuration for Alpine containers
- Support both GitHub Actions (rustup) and Alpine container (system) environments
This commit is contained in:
2025-08-31 12:44:55 +02:00
parent 041ad29a70
commit fb51f4eb4e
2 changed files with 36 additions and 15 deletions

View File

@@ -24,8 +24,8 @@ RUN apk add --no-cache \
sed \
coreutils
# Add Rust musl target
RUN rustup target add x86_64-unknown-linux-musl
# Install musl-dev for Rust musl targeting (Alpine handles this differently than rustup)
RUN apk add --no-cache musl-dev
# Create non-root user for builds
RUN adduser -D -s /bin/bash builder && \
@@ -34,9 +34,10 @@ RUN adduser -D -s /bin/bash builder && \
# Set working directory
WORKDIR /workspace
# Set environment variables for static linking
ENV RUSTFLAGS="-C target-feature=+crt-static"
ENV CC_x86_64_unknown_linux_musl="musl-gcc"
# Set environment variables for musl static linking with Alpine's Rust
ENV RUSTFLAGS="-C target-feature=+crt-static -C linker=musl-gcc"
ENV CC="musl-gcc"
ENV TARGET_CC="musl-gcc"
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="musl-gcc"
# Default to builder user