Fix Dockerfile heredoc parse error in RUN if block
Use printf instead of heredoc for cargo config — heredoc inside a conditional RUN block confuses Docker's parser (fi becomes an unknown instruction). The config is always written; unused linker entries are harmless on native builds.
This commit is contained in:
parent
3096d251c6
commit
3794f4cf36
1 changed files with 10 additions and 13 deletions
|
|
@ -29,19 +29,16 @@ RUN case "${TARGETARCH}:${TARGETVARIANT}" in \
|
||||||
esac > /rust_target && \
|
esac > /rust_target && \
|
||||||
rustup target add "$(cat /rust_target)"
|
rustup target add "$(cat /rust_target)"
|
||||||
|
|
||||||
# Tell Cargo which cross-linker to use — only needed when cross-compiling.
|
# Tell Cargo which cross-linker to use (ignored on native builds).
|
||||||
RUN if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then \
|
RUN mkdir -p /root/.cargo && printf '\
|
||||||
mkdir -p /root/.cargo && cat >> /root/.cargo/config.toml <<'EOF'
|
[target.aarch64-unknown-linux-gnu]\n\
|
||||||
[target.aarch64-unknown-linux-gnu]
|
linker = "aarch64-linux-gnu-gcc"\n\
|
||||||
linker = "aarch64-linux-gnu-gcc"
|
\n\
|
||||||
|
[target.armv7-unknown-linux-gnueabihf]\n\
|
||||||
[target.armv7-unknown-linux-gnueabihf]
|
linker = "arm-linux-gnueabihf-gcc"\n\
|
||||||
linker = "arm-linux-gnueabihf-gcc"
|
\n\
|
||||||
|
[target.arm-unknown-linux-gnueabi]\n\
|
||||||
[target.arm-unknown-linux-gnueabi]
|
linker = "arm-linux-gnueabi-gcc"\n' >> /root/.cargo/config.toml
|
||||||
linker = "arm-linux-gnueabi-gcc"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue