|
| 1 | +# This docker file builds the Rust binaries of our demos and packages them into a Torizon container |
| 2 | + |
| 3 | +ARG TOOLCHAIN_ARCH=arm64 |
| 4 | +ARG IMAGE_ARCH=linux/arm64 |
| 5 | +ARG BASE_NAME=wayland-base |
| 6 | +FROM torizon/debian-cross-toolchain-$TOOLCHAIN_ARCH:2-bullseye AS build |
| 7 | +ARG TOOLCHAIN_ARCH |
| 8 | +ARG RUST_TOOLCHAIN_ARCH=aarch64-unknown-linux-gnu |
| 9 | + |
| 10 | +# Install Rust |
| 11 | +ENV RUSTUP_HOME=/rust |
| 12 | +ENV CARGO_HOME=/cargo |
| 13 | +ENV PATH=/cargo/bin:/rust/bin:$PATH |
| 14 | + |
| 15 | +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y |
| 16 | +RUN rustup target add $RUST_TOOLCHAIN_ARCH |
| 17 | + |
| 18 | +ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc |
| 19 | +ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc |
| 20 | + |
| 21 | +# Install Slint build dependencies (libxcb, etc.) |
| 22 | +RUN apt-get update && \ |
| 23 | + apt-get install --assume-yes libfontconfig1-dev:$TOOLCHAIN_ARCH libxcb1-dev:$TOOLCHAIN_ARCH libxcb-render0-dev:$TOOLCHAIN_ARCH libxcb-shape0-dev:$TOOLCHAIN_ARCH libxcb-xfixes0-dev:$TOOLCHAIN_ARCH libxkbcommon-dev:$TOOLCHAIN_ARCH python3 clang libstdc++-10-dev:$TOOLCHAIN_ARCH && \ |
| 24 | + rm -rf /var/lib/apt/lists/* |
| 25 | + |
| 26 | +# Don't require font-config when the compiler runs |
| 27 | +ENV RUST_FONTCONFIG_DLOPEN=on |
| 28 | + |
| 29 | +# Build Demos |
| 30 | +COPY . /slint |
| 31 | +WORKDIR /slint |
| 32 | +RUN mkdir demos \ |
| 33 | + && for demo in printerdemo slide_puzzle gallery opengl_underlay carousel todo; do \ |
| 34 | + cargo build --release --target $RUST_TOOLCHAIN_ARCH --features slint/renderer-winit-skia -p $demo; \ |
| 35 | + cp target/$RUST_TOOLCHAIN_ARCH/release/$demo ./demos/; \ |
| 36 | + done |
| 37 | + |
| 38 | +# Create container for target |
| 39 | +FROM --platform=$IMAGE_ARCH torizon/$BASE_NAME:2 |
| 40 | + |
| 41 | +RUN apt-get update \ |
| 42 | + && apt-get install libfontconfig1 \ |
| 43 | + && rm -rf /var/lib/apt/lists/* |
| 44 | + |
| 45 | +COPY --from=build /slint/demos/* /usr/bin/ |
| 46 | + |
| 47 | +ENV SLINT_FULLSCREEN=1 |
| 48 | +ENV SLINT_BACKEND=winit-skia |
| 49 | +CMD /usr/bin/printerdemo |
0 commit comments