build: simplify detection of the target platform

It can be done within the container, rather than having to compute it in
the Makefile and then pass it as an argument.
This commit is contained in:
Saúl Ibarra Corretgé
2024-01-15 11:48:36 +01:00
parent 21f04ead6e
commit d31e164656
4 changed files with 15 additions and 32 deletions

View File

@@ -8,7 +8,6 @@ LABEL org.opencontainers.image.url="https://github.com/jitsi/jibri"
LABEL org.opencontainers.image.source="https://github.com/jitsi/docker-jitsi-meet"
LABEL org.opencontainers.image.documentation="https://jitsi.github.io/handbook/"
ARG TARGETPLATFORM
ARG USE_CHROMIUM=0
#ARG CHROME_RELEASE=latest
# https://googlechromelabs.github.io/chrome-for-testing/
@@ -21,9 +20,11 @@ RUN apt-dpkg-wrap apt-get update && \
/usr/bin/install-chrome.sh && \
apt-cleanup && \
adduser jibri rtkit && \
case ${TARGETPLATFORM} in \
"linux/amd64") SC_ARCH=x86_64 ;; \
"linux/arm64") SC_ARCH=aarch64 ;; \
dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
"amd64") SC_ARCH=x86_64 ;; \
"arm64") SC_ARCH=aarch64 ;; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
wget -qO /usr/bin/shm-check https://github.com/saghul/shm-check/releases/download/v1.0.0/shm-check-${SC_ARCH} && \
chmod +x /usr/bin/shm-check

View File

@@ -2,7 +2,9 @@
set -o pipefail -xeu
if [ "${USE_CHROMIUM}" = 1 -o "${TARGETPLATFORM}" = "linux/arm64" ]; then
dpkgArch="$(dpkg --print-architecture)"
if [ "${USE_CHROMIUM}" = 1 -o "${dpkgArch##*-}" = "arm64" ]; then
echo "Using Debian's Chromium"
apt-dpkg-wrap apt-get install -y chromium chromium-driver chromium-sandbox
chromium --version