-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathfirefox.py
More file actions
88 lines (85 loc) · 3.35 KB
/
firefox.py
File metadata and controls
88 lines (85 loc) · 3.35 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
85
86
87
88
"""Build description for the Firefox container, which is part of the
SUSE containerized kiosk solution.
"""
import textwrap
from bci_build.container_attributes import SupportLevel
from bci_build.os_version import ALL_NONBASE_OS_VERSIONS
from bci_build.os_version import CAN_BE_LATEST_OS_VERSION
from bci_build.os_version import OsVersion
from bci_build.package import DOCKERFILE_RUN
from bci_build.package import ApplicationStackContainer
from bci_build.package.helpers import generate_from_image_tag
from bci_build.package.kiosk import KIOSK_EXCLUSIVE_ARCH
from bci_build.package.kiosk import KIOSK_SUPPORT_ENDS
from bci_build.package.kiosk import KioskRegistry
from bci_build.replacement import Replacement
from bci_build.util import ParseVersion
FIREFOX_CONTAINERS = [
ApplicationStackContainer(
name=("kiosk-firefox" if os_version.is_tumbleweed else "firefox-esr"),
package_name=(None if os_version.is_tumbleweed else "kiosk-firefox-esr-image"),
os_version=os_version,
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
exclusive_arch=KIOSK_EXCLUSIVE_ARCH,
version=(ff_ver_re := "%%ff_ver%%"),
tag_version=None if os_version.is_tumbleweed else "esr",
is_singleton_image=True,
version_in_uid=False,
pretty_name="Mozilla Firefox",
_publish_registry=(KioskRegistry() if not os_version.is_tumbleweed else None),
from_target_image=generate_from_image_tag(os_version, "bci-micro"),
package_list=sorted(
[
"MozillaFirefox",
# for fonts to actually display
"xorg-x11-fonts",
# for puleaudio communication
"libpulse0",
# for cjk fonts
"noto-sans-cjk-fonts",
# Provides necessary codecs for video/audio playback
"libavcodec58_134",
]
+ (
[
"gconf2",
]
if os_version.is_sle15
else []
)
+ (
[
"MozillaFirefox-branding-openSUSE",
]
if os_version.is_tumbleweed
else [
"MozillaFirefox-branding-SLE",
]
)
),
replacements_via_service=[
Replacement(
ff_ver_re,
package_name="MozillaFirefox",
parse_version=ParseVersion.MINOR,
)
],
support_level=SupportLevel.L3,
supported_until=KIOSK_SUPPORT_ENDS,
cmd=["/bin/bash", "-c", "firefox --kiosk $URL"],
# TODO add package_version_check and tag_version
# Ensure that the user is created and Firefox has access to its profile directory.
build_stage_custom_end=textwrap.dedent(f"""\
{DOCKERFILE_RUN} useradd -m -u 1000 -U user
{DOCKERFILE_RUN} mkdir -p /home/user/.mozilla/firefox
{DOCKERFILE_RUN} chown -R user:user /home/user/.mozilla
"""),
custom_end=textwrap.dedent("""
ENV DISPLAY=":0"
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /home/user /home/user
"""),
)
for os_version in {v for v in ALL_NONBASE_OS_VERSIONS if v != OsVersion.SL16_0}
]