-
Notifications
You must be signed in to change notification settings - Fork 533
/
Dockerfile.torizon-demos
59 lines (45 loc) · 2.85 KB
/
Dockerfile.torizon-demos
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright © SixtyFPS GmbH <[email protected]>
# 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 && \
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 \
&& for demo in printerdemo slide_puzzle gallery opengl_underlay carousel todo energy-monitor; 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/; \
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/* /usr/bin/
ENV SLINT_FULLSCREEN=1
ENV SLINT_BACKEND=linuxkms-skia-opengl
CMD /usr/bin/energy-monitor