# Zero OS Alpine Initramfs Builder Container FROM alpine:3.22 # Install build dependencies RUN apk add --no-cache \ build-base \ rust \ cargo \ upx \ git \ wget \ tar \ gzip \ xz \ cpio \ binutils \ linux-headers \ musl-dev \ pkgconfig \ openssl-dev \ bash \ findutils \ grep \ sed \ coreutils # 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 matching host user RUN adduser -D -s /bin/bash builder # Set working directory with proper permissions WORKDIR /workspace RUN chown builder:builder /workspace # 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" # Don't switch to builder user yet - let the runtime handle it CMD ["/bin/bash"]