Skip to content

Commit

Permalink
Build Docker images against Clang and libcxx on Fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
garyttierney committed Oct 29, 2024
1 parent e752c48 commit 491bf45
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
!src
!Cargo.*
!.cargo/config.toml
*.o
*.dll
*.so
*.exe
*.lib
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ SHELL ["/bin/bash", "-c"]
ARG TARGET
ARG TARGET_CPU

RUN --mount=type=cache,target=/var/cache/dnf dnf install -y git clang binutils libcxx-devel libstdc++-devel libstdc++ lld
RUN --mount=type=cache,target=/var/cache/dnf dnf install -y git clang binutils libcxxabi-static libcxxabi-devel libcxx-devel libcxx-static libcxx libstdc++-devel libstdc++-static glibc-static lld

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.82.0

RUN --mount=type=cache,target=/usr/local/rustup curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VERSION}"

COPY . /work
WORKDIR /work

RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/rustup \
curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VERSION}" && \
rustup install stable && \
CXX=clang++ CC=clang LD=lld RUSTFLAGS="-C target-cpu=${TARGET_CPU}" cargo build --target ${TARGET} --bin laya --release
rustup target add ${TARGET} && \
CXXFLAGS="-stdlib=libc++ -lstdc++abi -lstdc++" cargo build --target ${TARGET} --bin laya --release && \
mkdir /out/ && mv /work/target/${TARGET}/release/laya /out/ && rm -Rf /work

FROM scratch
ARG TARGET
ARG TARGET_CPU

COPY --from=builder /work/target/${TARGET}/release/laya /bin/laya
COPY --from=builder /out/laya /bin/laya

ENTRYPOINT ["/bin/laya"]
2 changes: 1 addition & 1 deletion kaduceus
Submodule kaduceus updated 1 files
+13 −8 build.rs

0 comments on commit 491bf45

Please sign in to comment.