feat: Add perl for OpenSSL builds

- Add perl to Dockerfile for rfs OpenSSL compilation
- Clean up rustup environment (remove gcc complications)
- Ready for complete build debugging
This commit is contained in:
2025-08-31 16:21:30 +02:00
parent 1852135945
commit 7cf0d070ef
6 changed files with 382 additions and 44 deletions

View File

@@ -1,11 +1,10 @@
# Zero OS Alpine Initramfs Builder Container
FROM alpine:3.22
# Install build dependencies including proper musl toolchain
# Install build dependencies including rustup
RUN apk add --no-cache \
build-base \
rust \
cargo \
rustup \
upx \
git \
wget \
@@ -19,17 +18,19 @@ RUN apk add --no-cache \
musl-utils \
pkgconfig \
openssl-dev \
perl \
bash \
findutils \
grep \
sed \
coreutils
# Create musl-gcc wrapper (Alpine's gcc already targets musl)
RUN echo '#!/bin/sh' > /usr/bin/musl-gcc && \
echo 'exec gcc -static "$@"' >> /usr/bin/musl-gcc && \
chmod +x /usr/bin/musl-gcc && \
which musl-gcc
# Setup rustup with stable and musl target
RUN rustup-init -y && \
source /root/.cargo/env && \
rustup install stable && \
rustup target add x86_64-unknown-linux-musl && \
echo 'source /root/.cargo/env' >> /etc/profile
# Create non-root user for builds matching host user
RUN adduser -D -s /bin/bash builder
@@ -38,12 +39,8 @@ RUN adduser -D -s /bin/bash builder
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
# Set environment variables - rustup handles everything
ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUSTFLAGS="-C target-feature=+crt-static"
CMD ["/bin/bash"]