Files
trezor-suite/packages/transport-bluetooth/scripts/Dockerfile
2025-09-24 15:46:22 +02:00

54 lines
2.0 KiB
Docker

# https://github.com/joseluisq/rust-linux-darwin-builder/blob/master/README.md
FROM joseluisq/rust-linux-darwin-builder:1.85.1
RUN apt-get update && apt-get install -y mingw-w64 curl ca-certificates
# Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& corepack enable
WORKDIR /app
COPY ./src ./src
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
COPY ./build.rs ./build.rs
COPY ./build/ ./build/
ARG BUILD_VERSION_TAG
ENV BUILD_VERSION_TAG=${BUILD_VERSION_TAG}
# Build for Windows x64
RUN rustup target add x86_64-pc-windows-gnu && \
cargo build --target x86_64-pc-windows-gnu --release --bins && \
mkdir -p /output/win-x64 && \
cp ./target/x86_64-pc-windows-gnu/release/trezor-bluetooth.exe /output/win-x64/trezor-bluetooth.exe && \
x86_64-w64-mingw32-strip /output/win-x64/trezor-bluetooth.exe
# Build for Linux ARM64
RUN cargo build --target aarch64-unknown-linux-gnu --release --bins && \
mkdir -p /output/linux-arm64 && \
cp ./target/aarch64-unknown-linux-gnu/release/trezor-bluetooth /output/linux-arm64/trezor-bluetooth && \
aarch64-linux-gnu-strip /output/linux-arm64/trezor-bluetooth
# Build for Linux x64
RUN cargo build --target x86_64-unknown-linux-gnu --release --bins && \
mkdir -p /output/linux-x64 && \
cp ./target/x86_64-unknown-linux-gnu/release/trezor-bluetooth /output/linux-x64/trezor-bluetooth && \
strip /output/linux-x64/trezor-bluetooth
# Build for macOS ARM64
RUN rustup target add aarch64-apple-darwin && \
cargo build --target aarch64-apple-darwin --release --bins && \
mkdir -p /output/mac-arm64 && \
cp ./target/aarch64-apple-darwin/release/trezor-bluetooth /output/mac-arm64/trezor-bluetooth && \
llvm-strip /output/mac-arm64/trezor-bluetooth
# Build for macOS x64
RUN cargo build --target x86_64-apple-darwin --release --bins && \
mkdir -p /output/mac-x64 && \
cp ./target/x86_64-apple-darwin/release/trezor-bluetooth /output/mac-x64/trezor-bluetooth && \
llvm-strip /output/mac-x64/trezor-bluetooth