forked from klutchell/unbound-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (30 loc) · 1.04 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
#syntax=docker/dockerfile:1.2
# platform set by buildkit (DOCKER_BUILDKIT=1)
FROM --platform=$BUILDPLATFORM buildroot/base:20211120.1925 AS buildroot-base
ARG BR_VERSION=2022.02.8
RUN git clone --depth 1 --branch ${BR_VERSION} https://git.busybox.net/buildroot
FROM buildroot-base as rootfs
WORKDIR /home/br-user/buildroot
# set by buildkit (DOCKER_BUILDKIT=1)
ARG TARGETARCH
ARG TARGETVARIANT
# musl or glibc (musl is smaller)
ARG ROOTFS_LIBC=musl
COPY *.patch ./
RUN git apply ./*.patch
COPY config ./config
RUN support/kconfig/merge_config.sh -m \
config/arch/"${TARGETARCH}${TARGETVARIANT}".cfg \
config/libc/"${ROOTFS_LIBC}".cfg \
config/*.cfg
RUN --mount=type=cache,target=/cache,uid=1000,gid=1000,sharing=private \
make olddefconfig && make source && make && \
rm -rf output/build output/host
# hadolint ignore=DL3002
USER root
WORKDIR /rootfs
RUN tar xpf /home/br-user/buildroot/output/images/rootfs.tar -C /rootfs
FROM scratch
COPY --from=rootfs rootfs/ /
COPY --chown=unbound:unbound rootfs_overlay/ /
ENTRYPOINT [ "unbound" ]