forked from ublue-os/bazzite-arch
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Containerfile
128 lines (118 loc) · 3.56 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
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
FROM quay.io/toolbx/arch-toolbox AS arch-distrobox
# Pacman Initialization
# Create build user
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-key --init && pacman-key --populate && \
pacman -Syu --noconfirm && \
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 && \
pacman -S --clean --clean
# Distrobox Integration
RUN git clone https://github.com/89luca89/distrobox.git --single-branch /tmp/distrobox && \
cp /tmp/distrobox/distrobox-host-exec /usr/bin/distrobox-host-exec && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/flatpak && \
wget https://github.com/1player/host-spawn/releases/download/$(cat /tmp/distrobox/distrobox-host-exec | grep host_spawn_version= | cut -d "\"" -f 2)/host-spawn-$(uname -m) -O /usr/bin/host-spawn && \
chmod +x /usr/bin/host-spawn && \
rm -drf /tmp/distrobox
# Install packages Distrobox adds automatically, this speeds up first launch
RUN pacman -S \
adw-gtk-theme \
bash-completion \
bc \
curl \
diffutils \
findutils \
glibc \
gnupg \
inetutils \
keyutils \
less \
lsof \
man-db \
man-pages \
mlocate \
mtr \
ncurses \
nss-mdns \
openssh \
pigz \
pinentry \
procps-ng \
rsync \
shadow \
sudo \
tcpdump \
time \
traceroute \
tree \
tzdata \
unzip \
util-linux \
util-linux-libs \
vte-common \
wget \
words \
xorg-xauth \
zip \
mesa \
opengl-driver \
vulkan-intel \
vte-common \
vulkan-radeon \
--noconfirm && \
rm -rf /var/cache/pacman/pkg/*
# 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/placeholder \
# --noconfirm
USER root
WORKDIR /
# Cleanup
RUN sed -i 's@#en_US.UTF-8@en_US.UTF-8@g' /etc/locale.gen && \
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/*
FROM arch-distrobox AS arch-distrobox-amdgpupro
# Install amdgpu-pro, remove other drivers
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
USER build
WORKDIR /home/build
RUN paru -R \
libglvnd \
vulkan-intel \
vulkan-radeon \
mesa \
--noconfirm && \
paru -Syu \
amdgpu-pro-oglp \
lib32-amdgpu-pro-oglp \
vulkan-amdgpu-pro \
lib32-vulkan-amdgpu-pro \
amf-amdgpu-pro \
--noconfirm && \
sudo rm -rf /var/cache/pacman/pkg/* && \
rm -rf /home/build/.cache/*
USER root
WORKDIR /
# Cleanup
RUN 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/*