-
Notifications
You must be signed in to change notification settings - Fork 7
/
ubuntu_debian
132 lines (117 loc) · 4.95 KB
/
ubuntu_debian
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
ARG DIST="debian"
ARG SUITE="buster"
ARG QT_VERSION="5"
ARG REPOSITORY="https://github.com/hyperion-project"
FROM ${DIST}:${SUITE}
ARG DIST
ARG SUITE
ARG QT_VERSION
ARG REPOSITORY
ARG TARGETPLATFORM
LABEL maintainer="Hyperion Project <[email protected]>" \
org.opencontainers.image.title="${DIST} ${SUITE} ${TARGETPLATFORM} - QT ${QT_VERSION}" \
org.opencontainers.image.description="Compilation environment to build Hyperion for ${DIST} ${SUITE}" \
org.opencontainers.image.url="${REPOSITORY}" \
org.opencontainers.image.source="${REPOSITORY}/hyperion.docker-ci" \
org.opencontainers.image.vendor="Hyperion Project" \
org.opencontainers.image.documentation="https://docs.hyperion-project.org" \
org.opencontainers.image.licenses="MIT"
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
ENV QEMU_EXECVE=1
ENV DEBFULLNAME="Hyperion Project"
ENV DEBEMAIL="[email protected]"
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
ENV APT_INSTALL="apt-get -y install --no-install-recommends"
ENV APT_UPDATE="apt-get -y update"
ARG DEBIAN_FRONTEND=noninteractive
# update
RUN $APT_UPDATE
# install qt5 or qt6 (qt6 is not available on ubuntu focal and debian buster)
# on debian bullseye add backports to install qt6
RUN if [ "$SUITE" != "buster" ] && [ "$SUITE" != "focal" ] && [ "$QT_VERSION" = "6" ]; then \
if [ "$SUITE" = "bullseye" ]; then \
echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" | tee -a /etc/apt/sources.list; \
$APT_UPDATE; \
fi; \
$APT_INSTALL qt6-base-dev libqt6serialport6-dev libqt6sql6-sqlite libxkbcommon-dev libvulkan-dev libgl1-mesa-dev; \
else \
$APT_INSTALL qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev; \
fi
# install general deps (all platforms/arch/os)
RUN $APT_INSTALL \
devscripts \
fakeroot \
debhelper \
libdistro-info-perl \
git \
curl \
python3-dev \
build-essential \
ninja-build \
libusb-1.0-0-dev \
libcec-dev \
libp8-platform-dev \
libudev-dev \
libavahi-core-dev \
libavahi-compat-libdnssd-dev \
zlib1g-dev \
libasound2-dev \
libjpeg-dev \
libturbojpeg0-dev \
libmbedtls-dev \
libftdi1-dev \
libssl-dev \
libglib2.0-dev
# Install CMake on amd64 and arm64
# Compile and install CMake on armv7
ENV CMAKE_VERSION="3.28.3"
ENV CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}"
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
curl -OLs ${CMAKE_URL}-linux-x86_64.sh; \
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh; \
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix="/usr"; \
rm -rf cmake-${CMAKE_VERSION}-linux-x86_64.sh; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
curl -OLs ${CMAKE_URL}-linux-aarch64.sh; \
chmod +x cmake-${CMAKE_VERSION}-linux-aarch64.sh; \
./cmake-${CMAKE_VERSION}-linux-aarch64.sh --skip-license --prefix="/usr"; \
rm -rf cmake-${CMAKE_VERSION}-linux-aarch64.sh; \
else \
mkdir -p /tmp/cmake; \
cd /tmp/cmake; \
curl -kL ${CMAKE_URL}.tar.gz | tar zxf - -C . --strip-components 1; \
./bootstrap --prefix=/usr; \
make -j $(nproc); \
make install; \
cd && rm -rf /tmp/cmake; \
fi
# Show cmake version
RUN cmake --version
# install X11/XCB on Ubuntu for all arch and on Debian for amd64
# install libraspberrypi-dev on Debian for arm64/armhf
RUN if [ "$DIST" = "ubuntu" ] || [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
if [ "$QT_VERSION" = "5" ]; then \
$APT_INSTALL libqt5x11extras5-dev; \
fi; \
$APT_INSTALL libxcb-util0-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-image0-dev libxrandr-dev libxrender-dev; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$TARGETPLATFORM" = "linux/arm/v7" ] && [ "$SUITE" != "trixie" ]; then \
$APT_INSTALL wget gpg dirmngr gpg-agent; \
echo "deb http://archive.raspberrypi.org/debian ${SUITE} main ui" >> /etc/apt/sources.list.d/raspi.list; \
apt-key adv --keyserver keyserver.ubuntu.com --recv-key 0x82B129927FA3303E; \
$APT_UPDATE && $APT_INSTALL libraspberrypi-dev; \
rm /etc/apt/sources.list.d/raspi.list; \
fi
# download qemu
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
curl -kL https://github.com/balena-io/qemu/releases/download/v7.0.0%2Bbalena1/qemu-7.0.0.balena1-aarch64.tar.gz | tar zxvf - -C . --strip-components 1 && mv qemu-aarch64-static /usr/bin/qemu-static; \
elif [ "$TARGETPLATFORM" = "linux/arm/v6" ] || [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
curl -kL https://github.com/balena-io/qemu/releases/download/v7.0.0%2Bbalena1/qemu-7.0.0.balena1-arm.tar.gz | tar zxvf - -C . --strip-components 1 && mv qemu-arm-static /usr/bin/qemu-static; \
else \
printf '#!/bin/bash\nexec "$@"' > /usr/bin/qemu-static; \
fi
# set qemu exec flag
RUN chmod +x /usr/bin/qemu-static
# cleanup
RUN apt-get clean -q -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
# set entrypoint
ENTRYPOINT [ "/usr/bin/qemu-static" ]