-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
43 lines (35 loc) · 2.11 KB
/
Dockerfile.template
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
# Docker image when built on the official Docker infrastructure.
# They require us to verify the source integrity in some way while making sure that this is a
# reproducible build.
# See https://github.com/docker-library/official-images#image-build
# In order to achieve this, we externally host the rootfs archives and their checksums and then
# just download and verify it in the first stage of this Dockerfile.
# The second stage is for actually configuring the system a little bit.
# Some templating is done in order to allow us to easily build different configurations and to
# allow us to automate the release process.
# Note: Only official DockerHub images are allowed, see https://gitlab.archlinux.org/archlinux/archlinux-docker/-/commit/daa67d18579024947d69a45e6d028c5adb1c8c23
# While we could use archlinux:base it could also break our build process, so we avoid dog fooding here
FROM loongcr.lcpu.dev/lcpu/archlinux AS verify
COPY TEMPLATE_ROOTFS_FILE /
RUN pacman -Sy --noconfirm && pacman -S --noconfirm curl
RUN TEMPLATE_ROOTFS_DOWNLOAD && \
echo "TEMPLATE_ROOTFS_HASH" > /tmp/sha256sums.txt && \
sha256sum -c /tmp/sha256sums.txt && \
mkdir /rootfs && \
tar -C /rootfs --extract --file TEMPLATE_ROOTFS_FILE
FROM scratch AS root
LABEL org.opencontainers.image.title="TEMPLATE_TITLE"
LABEL org.opencontainers.image.description="Image of Loong Arch Linux"
LABEL org.opencontainers.image.authors="Yuanhang Sun <leavelet@163.com> "
LABEL org.opencontainers.image.url="https://github.com/lcpu-club/loongarchlinux-docker/blob/master/README.md"
LABEL org.opencontainers.image.documentation="https://wiki.archlinux.org/title/Docker#Arch_Linux"
LABEL org.opencontainers.image.source="https://github.com/lcpu-club/loongarchlinux-docker"
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
LABEL org.opencontainers.image.version="TEMPLATE_VERSION_ID"
LABEL org.opencontainers.image.revision="TEMPLATE_REVISION"
LABEL org.opencontainers.image.created="TEMPLATE_CREATED"
COPY --from=verify /rootfs/ /
RUN ldconfig && \
sed -i '/BUILD_ID/a VERSION_ID=TEMPLATE_VERSION_ID' /etc/os-release
ENV LANG=C.UTF-8
CMD ["/usr/bin/bash"]