forked from ublue-os/arch-distrobox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
81 lines (73 loc) · 3.22 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
FROM quay.io/toolbx/arch-toolbox AS arch-distrobox
# Pacman Initialization
# Create build user
RUN sed -i 's/#Color/Color/g' /etc/pacman.conf && \
sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j$(nproc)"/g' /etc/makepkg.conf && \
pacman-key --init && pacman-key --populate && \
pacman -Syu --noconfirm && \
pacman -S \
wget \
base-devel \
git \
--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
# 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 /tmp/distrobox && \
cp /tmp/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/docker && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/podman && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/rpm-ostree && \
ln -s /usr/bin/distrobox-host-exec /usr/bin/distrobox && \
wget -q 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
COPY base-packages.txt /
COPY extra-packages.txt /
COPY devbox.sh /
COPY --from=docker.io/dslim/slim:latest /bin/slim /usr/bin/slim
COPY --from=docker.io/dslim/slim:latest /bin/slim-sensor /usr/bin/slim-sensor
COPY --from=cgr.dev/chainguard/grype:latest /usr/bin/grype /usr/bin/grype
RUN grep -v '^#' /base-packages.txt | xargs pacman -Syu --noconfirm --needed && \
/bin/sh /devbox.sh
# Add paru and install custom and 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 && \
rm -drf /home/build/paru-bin && \
grep -v '^#' /extra-packages.txt | xargs paru -Syu --noconfirm --needed
USER root
WORKDIR /
# Helix symlink and shell completion
RUN ln -s /usr/lib/helix/hx /usr/bin/hx && \
devbox completion zsh > /usr/share/zsh/site-functions/_devbox && \
grype completion zsh > /usr/share/zsh/site-functions/_grype && \
curl -sfL https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker --output /usr/share/zsh/site-functions/_docker
# Cleanup
RUN sed -i 's@#en_US.UTF-8@en_US.UTF-8@g' /etc/locale.gen && \
echo "LANG=en_US.UTF-8" >> /etc/locale.conf && \
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/* \
/var/cache/pacman/pkg/* \
/base-packages.txt \
/extra-packages.txt \
/devbox.sh