mirror of
https://github.com/iv-org/inv_sig_helper.git
synced 2025-01-30 15:01:35 +01:00
Dockerfile: let Rustup handle architecture detection
More flexible as the build process will now automatically adapt to whatever architecture the container is being built on, without needing to explicitly list out each supported architecture
This commit is contained in:
parent
0b8ddf77b7
commit
6a07a2f47c
1 changed files with 2 additions and 12 deletions
14
Dockerfile
14
Dockerfile
|
@ -19,18 +19,8 @@ ENV OPENSSL_DIR=/usr
|
|||
# Copy the current directory contents into the container
|
||||
COPY . .
|
||||
|
||||
# Set up build arguments for architecture detection
|
||||
ARG TARGETARCH
|
||||
|
||||
# Set the Rust target based on the detected architecture
|
||||
RUN case "$TARGETARCH" in \
|
||||
"amd64") echo "x86_64-unknown-linux-musl" > /tmp/target ;; \
|
||||
"arm64") echo "aarch64-unknown-linux-musl" > /tmp/target ;; \
|
||||
*) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
|
||||
esac
|
||||
|
||||
# Add the target to rustup and build the application
|
||||
RUN RUST_TARGET=$(cat /tmp/target) && \
|
||||
# Determine the target architecture and build the application
|
||||
RUN RUST_TARGET=$(rustc -vV | sed -n 's/host: //p') && \
|
||||
rustup target add $RUST_TARGET && \
|
||||
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target $RUST_TARGET
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue