-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
137 lines (109 loc) · 3.68 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
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=
##
# Base container version
##
ARG SDK_BASE_VERSION=4-8.0-rc
ARG BASE_VERSION=next
##
# Directory of the application inside container
##
ARG APP_ROOT=
##
# Board GPU vendor prefix
##
ARG GPU=
# ARGUMENTS --------------------------------------------------------------------
# BUILD ------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS Build
ARG IMAGE_ARCH
ARG APP_ROOT
ENV RUST_BACKTRACE=1
# this is needed for the build to work witht he libslint
# FIXME: for now we need to use the xvfb-run to avoid the backend to crash
# this is a workaround and should be fixed in the future,
# I think that for interpret the .slint should not be needed to have
# a display server running. But we work with what we have.
RUN apt-get -q -y update && \
apt-get -q -y install \
libfontconfig1 \
mesa-utils \
x11-xserver-utils \
libxkbcommon-x11-0 \
libfontconfig1 \
libfreetype6 \
libgbm1 \
libinput10 \
libxkbcommon0 \
xkb-data \
xvfb
COPY . /build
WORKDIR /build
RUN dotnet restore && \
xvfb-run dotnet publish -c Release -r linux-${IMAGE_ARCH} && \
# we need to move the output to the correct folder
if [ "${IMAGE_ARCH}" = "amd64" ]; then \
mv /build/bin/Release/net8.0/linux-x64 /build/bin/Release/net8.0/linux-amd64 ; \
fi
# BUILD ------------------------------------------------------------------------
# DEPLOY ------------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base${GPU}:${BASE_VERSION} AS Deploy
ARG IMAGE_ARCH
ARG GPU
ARG APP_ROOT
# for vivante GPU we need some "special" sauce
RUN apt-get -q -y update && \
if [ "${GPU}" = "-vivante" ] || [ "${GPU}" = "-imx8" ]; then \
apt-get -q -y install \
imx-gpu-viv-wayland-dev \
; else \
apt-get -q -y install \
libgl1 \
; fi \
&& \
apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*
# Install Slint dependencies
# Install Slint and .net dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install \
libicu72 zlib1g unzip \
libfontconfig1 \
mesa-utils \
x11-xserver-utils \
libxkbcommon-x11-0 \
libfontconfig1 \
libfreetype6 \
libgbm1 \
libinput10 \
libxkbcommon0 \
xkb-data \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get -y update && apt-get install -y --no-install-recommends \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
# __torizon_packages_prod_start__
# __torizon_packages_prod_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
# use docker tools
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
COPY --from=docker:dind /usr/local/libexec/docker/cli-plugins /usr/local/lib/docker/cli-plugins
# Default to the Skia backend for best performance
ENV SLINT_BACKEND=winit-skia
# Default style to fluent
ENV SLINT_STYLE=fluent
# Copy the application compiled in the build step to the $APP_ROOT directory
# path inside the container, where $APP_ROOT is the torizon_app_root
# configuration defined in settings.json
COPY --from=Build /build/bin/Release/net8.0/linux-${IMAGE_ARCH}/publish ${APP_ROOT}
# "cd" (enter) into the APP_ROOT directory
WORKDIR ${APP_ROOT}
USER root
# Command executed in runtime when the container starts
CMD ["./torizonEmulatorManager"]
# DEPLOY ------------------------------------------------------------------------