-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
84 lines (73 loc) · 4.37 KB
/
Copy pathDockerfile
File metadata and controls
84 lines (73 loc) · 4.37 KB
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
# syntax=docker/dockerfile:1.4
FROM rubensa/ubuntu-tini-dev
LABEL author="Ruben Suarez <rubensa@gmail.com>"
# Architecture component of TARGETPLATFORM (platform of the build result)
ARG TARGETARCH
# Tell docker that all future commands should be run as root
USER root
# Set root home directory
ENV HOME=/root
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Debian repo version used to install chromium (18.04-buster,20.04-bullseye,22.04-bookworm,24.04-trixie)
ARG DEBIAN_VERSION=trixie
# Install Google Noto font family
RUN <<EOT
echo "# Installing Google Noto font family..."
apt-get update
apt-get -y install fonts-noto 2>&1
EOT
RUN <<EOT
RUN
if [ "$TARGETARCH" = "amd64" ]; then
echo "# Installing chrome dependencies..."
# Install chrome dependencies
apt-get -y install --no-install-recommends libgl1 libglx-mesa0 libgl1-mesa-dri libx11-xcb1 pulseaudio-utils 2>&1
# Add google chrome repo
mkdir -p /etc/apt/keyrings/
curl -sSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/keyrings/google.gpg
printf "deb [signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
# Install google chrome
echo "# Installing chrome..."
apt-get update
apt-get -y install --no-install-recommends google-chrome-stable 2>&1
elif [ "$TARGETARCH" = "arm64" ]; then
# Add debian repo cause neither official arm64 chrome exists nor Ubuntu has deb package
# In case it's the first time that the user runs gpg and the directory /root/.gnupg/ doesn't exist yet
gpg -k
# Fix: "gpg: keyserver receive failed: Cannot assign requested address"
# see: https://github.com/usbarmory/usbarmory-debian-base_image/issues/9#issuecomment-451635505
echo "disable-ipv6" >> /root/.gnupg/dirmngr.conf
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
# Fix: "GPG error: http://http.us.debian.org/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY 78DBA3BC47EF2265 NO_PUBKEY F8D2585B8783D481"
# Fix: "GPG error: http://http.us.debian.org/debian trixie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY 78DBA3BC47EF2265 NO_PUBKEY 762F67A0B2C39DE4"
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys 78DBA3BC47EF2265
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys F8D2585B8783D481
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian.gpg --keyserver keyserver.ubuntu.com --recv-keys 762F67A0B2C39DE4
chmod a+r /etc/apt/trusted.gpg.d/debian.gpg
printf "deb http://http.us.debian.org/debian ${DEBIAN_VERSION} main contrib non-free" > /etc/apt/sources.list.d/debian.list
# Configure apt to install chromium from debian repo
printf "Package: chromium*\n\rPin: release a=${DEBIAN_VERSION}\n\rPin-Priority: 501\n\r\n\rPackage: *\n\rPin: release a=${DEBIAN_VERSION}\n\rPin-Priority: -10\n\r" > /etc/apt/preferences.d/99debian-updates
# Install chromium
echo "# Installing chrome..."
# Use --force-overwrite to avoid error (libc6-dev:arm64 (2.36-6)): trying to overwrite '/usr/lib/aarch64-linux-gnu/audit/sotruss-lib.so', which is also in package libc6:arm64 2.35-0ubuntu3.1
apt-get update
apt-get -y install --no-install-recommends -o Dpkg::Options::="--force-overwrite" chromium 2>&1
# Make chromium look-like chrome
ln -s /usr/bin/chromium /usr/bin/google-chrome
fi
EOT
# Clean up apt
RUN <<EOT
RUN apt-get autoremove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/*
EOT
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
# Tell docker that all future commands should be run as the non-root user
USER ${USER_NAME}
# Set user home directory (see: https://github.com/microsoft/vscode-remote-release/issues/852)
ENV HOME=/home/$USER_NAME