-
Notifications
You must be signed in to change notification settings - Fork 41
/
base.Dockerfile
72 lines (51 loc) · 1.99 KB
/
base.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
72
FROM manjarolinux/base:latest as base
# squashing the whole base image into one layer
FROM scratch AS build
COPY --from=base / /
COPY pacman.conf /etc/pacman.conf
ARG TARGETPLATFORM
ARG CACHEBUST=1
ENV LANG=en_US.UTF-8
ENV PATH="/usr/bin:${PATH}"
RUN uname -m && \
pacman-key --init && \
pacman-mirrors --geoip
RUN [[ "${TARGETPLATFORM}" == "linux/amd64" ]] || exit 0 && \
pacman -Syyu --noconfirm --needed archlinux-keyring manjaro-keyring && \
pacman-key --populate archlinux manjaro
RUN [[ "${TARGETPLATFORM}" == "linux/arm64" ]] || exit 0 && \
pacman -Syyu --noconfirm --needed archlinuxarm-keyring manjaro-arm-keyring && \
pacman-key --populate archlinuxarm manjaro-arm
# set everything to be a dependency
RUN pacman -Qeq | grep -q ^ && pacman -D --asdeps $(pacman -Qeq) || echo "nothing to set as dependency"
# mark all base pkgs as explicitly installed
RUN pacman -S --asexplicit --needed --noconfirm base
# mark essentials as explicitly installed
RUN pacman -S --asexplicit --needed --noconfirm \
lsb-release \
manjaro-release \
pacman
# remove everything not needed
RUN pacman -Qtdq | grep -v base && pacman -Rsunc --noconfirm $(pacman -Qtdq | grep -v base) systemd || echo "nothing to remove"
# upgrade glibc
RUN rm -f /usr/include/bits/struct_stat.h \
/usr/include/bits/types/struct___jmp_buf_tag.h \
/usr/include/bits/types/struct_timeb.h \
/usr/share/locale/sr/LC_MESSAGES/libc.mo && \
pacman -Q --info glibc && \
pacman -Syy glibc --noconfirm && \
pacman -Q --info glibc && \
pacman -Syu --noconfirm
# install some base pkgs for local-gen
RUN pacman -Syy --noconfirm sed gzip
# enable at least one locale in locale.gen
RUN sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen && \
locale-gen
# debug output release info
RUN ls /etc/*-release && cat /etc/*-release
# clean pacman cache
RUN rm -f /var/cache/pacman/pkg/*
## final docker image
FROM scratch AS release
COPY --from=build / /
CMD ["/usr/bin/sh"]