forked from ublue-os/bazzite-arch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
100 lines (93 loc) · 3.53 KB
/
Containerfile
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
FROM docker.io/library/archlinux:latest
# Support Nvidia Container Runtime (https://developer.nvidia.com/nvidia-container-runtime)
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
# Pacman Initialization
RUN sed -i 's/#Color/Color/g' /etc/pacman.conf && \
printf "[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" | tee -a /etc/pacman.conf && \
sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j$(nproc)"/g' /etc/makepkg.conf && \
pacman -Syu --noconfirm && \
pacman -S \
wget \
base-devel \
git \
--noconfirm
# Create build user
RUN useradd -m --shell=/bin/bash build && usermod -L build && \
echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Distrobox Integration
USER build
WORKDIR /home/build
RUN git clone https://github.com/KyleGospo/xdg-utils-distrobox-arch.git --single-branch && \
cd xdg-utils-distrobox-arch/trunk && \
makepkg -si --noconfirm && \
cd ../.. && \
rm -drf xdg-utils-distrobox-arch
USER root
WORKDIR /
RUN git clone https://github.com/89luca89/distrobox.git --single-branch && \
cp distrobox/distrobox-host-exec /usr/bin/distrobox-host-exec && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/flatpak && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/firefox && \
wget https://github.com/1player/host-spawn/releases/download/$(cat distrobox/distrobox-host-exec | grep host_spawn_version= | cut -d "\"" -f 2)/host-spawn-$(uname -m) -O distrobox/host-spawn && \
cp distrobox/host-spawn /usr/bin/host-spawn && \
chmod +x /usr/bin/host-spawn && \
rm -drf distrobox
# Install needed packages
RUN pacman -S \
vulkan-radeon \
lib32-vulkan-radeon \
libva-mesa-driver \
intel-media-driver \
openal \
pipewire \
pipewire-pulse \
pipewire-alsa \
pipewire-jack \
wireplumber \
lib32-pipewire \
lib32-pipewire-jack \
lib32-libpulse \
lib32-openal \
xdg-desktop-portal-kde \
neofetch \
fish \
--noconfirm && \
pacman -S \
steam \
lutris \
mangohud \
lib32-mangohud \
--noconfirm
# Steam/Lutris/Wine installed separately so they use the dependencies above and don't try to install their own.
# Add paru and install AUR packages
USER build
WORKDIR /home/build
RUN git clone https://aur.archlinux.org/paru-bin.git --single-branch && \
cd paru-bin && \
makepkg -si --noconfirm && \
cd .. && \
rm -drf paru-bin && \
paru -S \
aur/protontricks \
aur/latencyflex-git \
aur/vkbasalt \
aur/lib32-vkbasalt \
aur/obs-vkcapture-git \
aur/lib32-obs-vkcapture-git \
--noconfirm
USER root
WORKDIR /
# Cleanup
# Native march & tune. This is a gaming image and not something a user is going to compile things in with the intent to share.
# We do this last because it'll only apply to updates the user makes going forward. We don't want to optimize for the build host's environment.
RUN wget https://raw.githubusercontent.com/ublue-os/bazzite/main/system_files/deck/shared/usr/bin/bazzite-steam-runtime -O /usr/bin/bazzite-steam-runtime && \
sed -i 's/-march=x86-64 -mtune=generic/-march=native -mtune=native/g' /etc/makepkg.conf && \
userdel -r build && \
rm -drf /home/build && \
sed -i '/build ALL=(ALL) NOPASSWD: ALL/d' /etc/sudoers && \
sed -i '/root ALL=(ALL) NOPASSWD: ALL/d' /etc/sudoers && \
rm -rf \
/tmp/* \
/var/cache/pacman/pkg/*