Skip to content

Commit

Permalink
Use a rust layer with a full app build
Browse files Browse the repository at this point in the history
  • Loading branch information
muzuke committed Sep 23, 2024
1 parent 8f07e2e commit fced871
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/docker-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ jobs:
build_rust:
strategy:
matrix:
os: ["ubuntu-latest-8-cores", "ubuntu-latest-arm-8-cores"]
arch: ["amd64", "arm64"]
# os: ["ubuntu-latest-8-cores", "ubuntu-latest-arm-8-cores"]
# arch: ["amd64", "arm64"]
os: ["ubuntu-latest-8-cores"]
arch: ["amd64"]
exclude:
- os: ubuntu-latest-8-cores
arch: arm64
Expand All @@ -83,20 +85,21 @@ jobs:
name: Build libcorerust
runs-on: ${{ matrix.os }}
container:
image: radixdlt/build-layers:rust-v1
image: radixdlt/build-layers:rust-full-build
options: --user root
steps:
- name: Checkout
uses: RDXWorks-actions/checkout@main
- name: Setup rust toolchain
uses: RDXWorks-actions/[email protected]
- name: Setup rust cache
uses: RDXWorks-actions/rust-cache@master
with:
workspaces: core-rust
- name: Copy target directory
run: |
mv /app/core-rust/target ./core-rust/target
- name: Build
working-directory: core-rust
run: |
export PATH="$PATH:/root/.cargo/bin"
which cargo
rustup default 1.77
du -hs target
cargo build --profile=release
- name: Upload artifacts
uses: RDXWorks-actions/upload-artifact-v4@main
Expand Down
11 changes: 6 additions & 5 deletions docker/dockerfiles/rust.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ RUN apt-get update \
# We fix the version of Rust here to ensure that we can update it without having
# issues with the caching layers containing outdated versions which aren't compatible.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh \
&& sh rustup.sh -y --target 1.71.1-aarch64-unknown-linux-gnu 1.71.1-x86_64-unknown-linux-gnu --default-toolchain 1.77.2
&& sh rustup.sh -y --default-toolchain 1.77.2

RUN "$HOME/.cargo/bin/cargo" install sccache --version 0.7.4
ENV PATH="$PATH:/root/.cargo/bin"

ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
ENV RUSTC_WRAPPER=/root/.cargo/bin/sccache
COPY . .

RUN cd core-rust && \
cargo build --profile=release

0 comments on commit fced871

Please sign in to comment.