forked from torizon/vscode-torizon-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.debug
170 lines (143 loc) · 4.37 KB
/
Dockerfile.debug
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=
# For armv7 use:
#ARG IMAGE_ARCH=arm
##
# Base container version
##
ARG BASE_VERSION=3.0.8
##
# Application Name
##
ARG APP_EXECUTABLE=app
##
# Debug port
##
ARG SSH_DEBUG_PORT=
##
# Run as
##
ARG SSHUSERNAME=
ARG APP_ROOT=
##
# Board GPU vendor prefix
##
ARG GPU=
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base${GPU}:${BASE_VERSION} AS opengles
ARG IMAGE_ARCH
ARG GPU
ARG SSH_DEBUG_PORT
ARG APP_EXECUTABLE
ARG SSHUSERNAME
ENV APP_EXECUTABLE ${APP_EXECUTABLE}
ARG APP_ROOT
# Make sure we don't get notifications we can't answer during building.
ENV DEBIAN_FRONTEND="noninteractive"
# stick to bookworm on /etc/apt/sources.list.d
RUN sed -i 's/sid/bookworm/g' /etc/apt/sources.list.d/debian.sources
# Install required packages
RUN apt-get -q -y update && \
apt-get -q -y install \
libqt5gui5-gles libqt5quick5-gles \
&& apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base${GPU}:${BASE_VERSION} AS Debug
ARG IMAGE_ARCH
ARG GPU
ARG SSH_DEBUG_PORT
ARG APP_EXECUTABLE
ARG SSHUSERNAME
ENV APP_EXECUTABLE ${APP_EXECUTABLE}
ARG APP_ROOT
# SSH for remote debug
EXPOSE ${SSH_DEBUG_PORT}
EXPOSE 6512
ENV QT_QPA_PLATFORM="wayland"
# Make sure we don't get notifications we can't answer during building.
ENV DEBIAN_FRONTEND="noninteractive"
# for vivante GPU we need some "special" sauce
RUN apt-get -q -y update && \
if [ "${GPU}" = "-vivante" ]; 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/*
# your regular RUN statements here
# Install required packages
RUN apt-get -q -y update && \
apt-get -q -y install \
openssl \
openssh-server \
rsync \
file \
screen \
python3-minimal \
python3-pip \
python3-setuptools \
python3-venv \
python3-debugpy \
qml-module-qtquick-controls \
qml-module-qtquick-controls2 \
qml-module-qtquick2 \
python3-pyside2.qtwidgets \
python3-pyside2.qtgui \
python3-pyside2.qtqml \
python3-pyside2.qtcore \
python3-pyside2.qtquick \
python3-pyside2.qtnetwork \
qml-module-qtquick-dialogs \
qtwayland5 \
&& apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*
# replace the libs from the opengles image
COPY --from=opengles /usr/lib/aarch64-linux-gnu /usr2/lib/aarch64-linux-gnu
# rsync the files
RUN rsync -a /usr2/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu && \
rm -rf /usr2
# automate for torizonPackages.json
RUN apt-get -q -y update && \
apt-get -q -y install \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
# __torizon_packages_dev_start__
# __torizon_packages_dev_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/*
# Create virtualenv
RUN python3 -m venv ${APP_ROOT}/.venv --system-site-packages
# Install pip packages on venv
COPY requirements-debug.txt /requirements-debug.txt
RUN . ${APP_ROOT}/.venv/bin/activate && \
pip3 install --upgrade pip && pip3 install --break-system-packages -r requirements-debug.txt && \
rm requirements-debug.txt
# ⚠️ DEBUG PURPOSES ONLY!!
# copies RSA key to enable SSH login for user
COPY .conf/id_rsa.pub /id_rsa.pub
# create folders needed for the different components
# configures SSH access to the container and sets environment by default
RUN mkdir /var/run/sshd && \
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' \
-i /etc/pam.d/sshd && \
if test $SSHUSERNAME != root ; \
then mkdir -p /home/$SSHUSERNAME/.ssh ; \
else mkdir -p /root/.ssh ; fi && \
if test $SSHUSERNAME != root ; \
then cp /id_rsa.pub /home/$SSHUSERNAME/.ssh/authorized_keys ; \
else cp /id_rsa.pub /root/.ssh/authorized_keys ; fi && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config && \
echo "Port ${SSH_DEBUG_PORT}" >> /etc/ssh/sshd_config && \
su -c "env" $SSHUSERNAME > /etc/environment
RUN rm -r /etc/ssh/ssh*key && \
dpkg-reconfigure openssh-server
CMD [ "/usr/sbin/sshd", "-D" ]