Skip to content

Commit

Permalink
Add support for x86-64 microarchitecture levels
Browse files Browse the repository at this point in the history
  • Loading branch information
dfunkt committed Feb 12, 2025
1 parent 332bf71 commit 037125d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ RUN echo "export CARGO_TARGET=${RUST_MUSL_CROSS_TARGET}" >> /env-cargo && \
cat /env-cargo

RUN source /env-cargo && \
rustup target add "${CARGO_TARGET}"
rustup target add "${CARGO_TARGET}" && \
# Set target CPU to the specified x86-64 microarchitecture level (if present)
if [[ "${TARGETARCH}${TARGETVARIANT}" == amd64v* ]] ; then echo "export RUSTFLAGS='-Ctarget_cpu=x86-64-${TARGETVARIANT}'" >> /env-cargo ; fi && \
# Output the current contents of the file
cat /env-cargo

# Copies over *only* your manifests and build files
COPY ./Cargo.* ./rust-toolchain.toml ./build.rs ./
Expand Down
6 changes: 5 additions & 1 deletion docker/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ RUN source /env-cargo && \
cat /env-cargo

RUN source /env-cargo && \
rustup target add "${CARGO_TARGET}"
rustup target add "${CARGO_TARGET}" && \
# Set target CPU to the specified x86-64 microarchitecture level (if present)
if [[ "${TARGETARCH}${TARGETVARIANT}" == amd64v* ]] ; then echo "export RUSTFLAGS='-Ctarget_cpu=x86-64-${TARGETVARIANT}'" >> /env-cargo ; fi && \
# Output the current contents of the file
cat /env-cargo

# Copies over *only* your manifests and build files
COPY ./Cargo.* ./rust-toolchain.toml ./build.rs ./
Expand Down
6 changes: 5 additions & 1 deletion docker/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ RUN echo "export CARGO_TARGET=${RUST_MUSL_CROSS_TARGET}" >> /env-cargo && \

{% endif %}
RUN source /env-cargo && \
rustup target add "${CARGO_TARGET}"
rustup target add "${CARGO_TARGET}" && \
# Set target CPU to the specified x86-64 microarchitecture level (if present)
if [[ "${TARGETARCH}${TARGETVARIANT}" == amd64v* ]] ; then echo "export RUSTFLAGS='-Ctarget_cpu=x86-64-${TARGETVARIANT}'" >> /env-cargo ; fi && \
# Output the current contents of the file
cat /env-cargo

# Copies over *only* your manifests and build files
COPY ./Cargo.* ./rust-toolchain.toml ./build.rs ./
Expand Down

0 comments on commit 037125d

Please sign in to comment.