forked from fwcd/docker-archlinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (63 loc) · 3.09 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
66
67
68
69
70
71
#FROM ghcr.io/fwcd/archlinux:latest AS bootstrap
FROM pkgforge/archlinux:latest AS bootstrap
#------------------------------------------------------------------------------------#
##Build Args
ARG TARGETARCH
ARG TARGETVARIANT
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
##Bootstrap
COPY /bootstrap/any /
COPY /bootstrap/${TARGETARCH}${TARGETVARIANT} /
COPY /rootfs/any /rootfs
COPY /rootfs/${TARGETARCH}${TARGETVARIANT} /rootfs
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
##Install the base packages
RUN cat /etc/bootstrap-packages.txt | xargs pacstrap-docker /rootfs 2>/dev/null
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
##Fixes
# Fix marginal trust errors on Arch Linux ARM
RUN <<EOS
set +e
sed -i 's/^\(GPG_PACMAN=(.*\))/\1 --allow-weak-key-signatures)/g' "/rootfs/usr/bin/pacman-key" 2>/dev/null || true
rm /rootfs/var/lib/pacman/sync/* 2>/dev/null || true
sed 's/DownloadUser/#DownloadUser/g' -i "/etc/pacman.conf" 2>/dev/null || true
EOS
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
##Copy the bootstrapped rootfs
FROM scratch
COPY --from=bootstrap /rootfs /
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
##Initialize
# Set up pacman-key without distributing the lsign key
# See https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/301942f9e5995770cb5e4dedb4fe9166afa4806d/README.md#principles
# Source: https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/301942f9e5995770cb5e4dedb4fe9166afa4806d/Makefile#L22
RUN <<EOS
set +e
pacman-key --init 2>/dev/null || true
pacman-key --populate 2>/dev/null || true
bash -c "rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*" 2>/dev/null || true
sed 's/DownloadUser/#DownloadUser/g' -i "/etc/pacman.conf" 2>/dev/null || true
EOS
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
#ENV
RUN <<EOS
#Locale
echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/environment"
echo "en_US.UTF-8 UTF-8" | tee -a "/etc/locale.gen"
echo "LANG=en_US.UTF-8" | tee -a "/etc/locale.conf"
locale-gen "en_US.UTF-8"
EOS
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
ENV LC_ALL="en_US.UTF-8"
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
#Entrypoint
CMD ["/usr/bin/bash"]
#------------------------------------------------------------------------------------#