-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
65 lines (50 loc) · 2.33 KB
/
Dockerfile
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
FROM archlinux:base-devel AS build
# Update & setup sudo user
RUN pacman -Syu --noconfirm && \
echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers && \
useradd --uid 1000 --shell /bin/bash --groups wheel --create-home build
USER build
WORKDIR /home/build
# Build aurutils & aurto
RUN curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz | tar xz && \
cd aurutils && \
gpg --recv-keys DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A && \
makepkg -si --noconfirm && \
cd .. && \
curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/aurto.tar.gz | tar xz && \
cd aurto && \
makepkg -si --noconfirm
FROM archlinux:latest
ENV USER_ID="1002" \
USER=aurto
WORKDIR /
# Remove unnecessary units
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* \
/lib/systemd/system/systemd-update-utmp*
# Install dependencies and setup sudo user
RUN pacman -Syu --needed --noconfirm base-devel sudo pacman-contrib && \
echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers && \
useradd --uid ${USER_ID} --shell /bin/bash --groups wheel --create-home aurto
WORKDIR /tmp
# Copy aurutils & aurto from build stage
COPY --from=build /home/build/aurutils/aurutils-*.pkg.tar.zst /tmp/
COPY --from=build /home/build/aurto/aurto-*.pkg.tar.zst /tmp/
# Install aurto & aurutils
RUN pacman -U --noconfirm /tmp/aurutils-*.pkg.tar.zst && \
pacman -U --noconfirm /tmp/aurto-*.pkg.tar.zst && \
# Disable chroot for aurto
touch /usr/lib/aurto/conf-disable-chroot && \
# Cleanup
rm -r /tmp/* && \
paccache -rk0 && \
# Setup pacman hook
mkdir -p /etc/pacman.d/hooks/ && \
echo -e "[Trigger]\nType = Package\nOperation = Remove\nOperation = Install\nOperation = Upgrade\nTarget = *\n\n[Action]\nDescription = Removing unnecessary cached files (keeping the latest one)...\nWhen = PostTransaction\nExec = /usr/bin/paccache -rk0" > /etc/pacman.d/hooks/pacman-cache-cleanup.hook
WORKDIR /home/aurto
VOLUME ["/tmp", "/run", "/run/lock", "/etc/aurto", "/var/cache/pacman/aurto"]
CMD [ "/lib/systemd/systemd", "log-level=info", "unit=sysinit.target" ]