mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
59 lines
2.9 KiB
Text
59 lines
2.9 KiB
Text
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
# This docker file builds the Rust binaries of our demos and packages them into a Torizon container
|
|
|
|
ARG TOOLCHAIN_ARCH=arm64
|
|
ARG IMAGE_ARCH=linux/arm64
|
|
ARG BASE_NAME=wayland-base
|
|
FROM torizon/debian-cross-toolchain-$TOOLCHAIN_ARCH:3-bookworm AS build
|
|
ARG TOOLCHAIN_ARCH
|
|
ARG RUST_TOOLCHAIN_ARCH=aarch64-unknown-linux-gnu
|
|
|
|
ARG WEATHER_API_KEY
|
|
ENV WEATHER_API=$WEATHER_API_KEY
|
|
|
|
# Install Rust
|
|
ENV RUSTUP_HOME=/rust
|
|
ENV CARGO_HOME=/cargo
|
|
ENV PATH=/cargo/bin:/rust/bin:$PATH
|
|
|
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
RUN rustup target add $RUST_TOOLCHAIN_ARCH
|
|
|
|
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
|
|
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
|
|
|
|
# Install Slint build dependencies (libxcb, etc.)
|
|
RUN apt-get update && \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --allow-change-held-packages pkg-config 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 libinput-dev:$TOOLCHAIN_ARCH libudev-dev:$TOOLCHAIN_ARCH libgbm-dev:$TOOLCHAIN_ARCH libdrm2:$TOOLCHAIN_ARCH libdrm2- libdrm-amdgpu1- python3 clang libstdc++-11-dev:$TOOLCHAIN_ARCH ninja-build && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Don't require font-config when the compiler runs
|
|
ENV RUST_FONTCONFIG_DLOPEN=on
|
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
|
|
|
# Build Demos
|
|
COPY . /slint
|
|
WORKDIR /slint
|
|
RUN mkdir demos_compiled \
|
|
&& for demo in printerdemo slide_puzzle gallery opengl_underlay carousel todo energy-monitor home-automation weather-demo; do \
|
|
cargo build --release --target $RUST_TOOLCHAIN_ARCH --features slint/renderer-skia,slint/backend-linuxkms-noseat -p $demo || exit 1; \
|
|
cp target/$RUST_TOOLCHAIN_ARCH/release/$demo ./demos_compiled/; \
|
|
done
|
|
|
|
# Create container for target
|
|
FROM --platform=$IMAGE_ARCH torizon/$BASE_NAME:3
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/slint-ui/slint
|
|
LABEL org.opencontainers.image.description="Container image providing Slint demos for use on Torizon. Run with docker run --user=torizon -v /run/udev:/run/udev -v /dev:/dev -v /tmp:/tmp --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 4:* rmw'. Available demos: printerdemo slide_puzzle gallery opengl_underlay carousel todo"
|
|
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install libfontconfig1 libxkbcommon0 libinput10 fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-noto-color-emoji fonts-noto-ui-core fonts-noto-ui-extra \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=build /slint/demos_compiled/* /usr/bin/
|
|
|
|
ENV SLINT_FULLSCREEN=1
|
|
ENV SLINT_BACKEND=linuxkms-skia-opengl
|
|
CMD /usr/bin/energy-monitor
|