forked from sophmi/laya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (25 loc) · 1.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
ARG TARGET="x86_64-unknown-linux-gnu"
ARG TARGET_CPU="native"
FROM docker.io/library/fedora:latest AS builder
SHELL ["/bin/bash", "-c"]
ARG TARGET
ARG TARGET_CPU
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
WORKDIR /work
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/rustup \
--mount=type=bind,target=/work,rw \
curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VERSION}" && \
rustup install stable && \
rustup target add ${TARGET} && \
TARGET_CPU=${TARGET_CPU} RUSTC=/work/share/rustc.wrap cargo build --offline --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 /out/laya /bin/laya
ENTRYPOINT ["/bin/laya"]