Skip to content

Commit

Permalink
another conditional for cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlcibiades committed Nov 13, 2023
1 parent f4b4c58 commit 818f970
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ COPY --from=planner /opt/foundry /opt/foundry
# Get the lock-like file
COPY --from=planner /opt/foundry/recipe.json recipe.json

RUN apt-get update -y && apt-get install -y gcc-aarch64-linux-gnu
RUN if [[ "$TARGETARCH" = "arm64" ]]; then \
apt-get update -y && apt-get install -y gcc-aarch64-linux-gnu; \
fi

# Build our project dependencies, not our application!
RUN cargo chef cook --release --recipe-path recipe.json
Expand All @@ -30,7 +32,8 @@ RUN cargo chef cook --release --recipe-path recipe.json
# Conditional for cross compliation
RUN if [[ "$TARGETARCH" = "arm64" ]]; then \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CFLAGS=-mno-outline-atomics cargo build --release; else cargo build --release; fi
CFLAGS=-mno-outline-atomics cargo build --release; else cargo build --release; fi \

# Strip any debug symbols
RUN strip /opt/foundry/target/release/forge \
&& strip /opt/foundry/target/release/cast \
Expand Down

0 comments on commit 818f970

Please sign in to comment.