Files
unbound-docker/Dockerfile
T
Kyle Harding a3243a2366 Dockerfile: use buildkit platform args
When building with buildkit (such as buildx) we have a number of
platform args made available in the global scope.

https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope

By using these we can switch between rootfs base images and avoid the need
for qemu emulation when compiling with buildroot.

Change-type: minor
Signed-off-by: Kyle Harding <kyle@balena.io>
2020-12-09 13:50:00 -05:00

52 lines
1.6 KiB
Docker

ARG BR_VERSION=2020.11
# hadolint ignore=DL3029
FROM --platform=$BUILDPLATFORM klutchell/buildroot-rootfs-amd64:$BR_VERSION as rootfs-amd64
# hadolint ignore=DL3029
FROM --platform=$BUILDPLATFORM klutchell/buildroot-rootfs-arm64:$BR_VERSION as rootfs-arm64
# hadolint ignore=DL3029
FROM --platform=$BUILDPLATFORM klutchell/buildroot-rootfs-arm32v7:$BR_VERSION as rootfs-armv7
# hadolint ignore=DL3029
FROM --platform=$BUILDPLATFORM klutchell/buildroot-rootfs-arm32v6:$BR_VERSION as rootfs-armv6
# hadolint ignore=DL3006
FROM rootfs-$TARGETARCH$TARGETVARIANT as build
COPY package ./package
COPY rootfs_overlay ./rootfs_overlay
COPY config.pkg ./config.pkg
RUN support/kconfig/merge_config.sh -m .config config.pkg
RUN make olddefconfig && make source
RUN make
# hadolint ignore=DL3002
USER root
WORKDIR /rootfs
RUN tar xpf /home/br-user/output/images/rootfs.tar -C /rootfs
FROM scratch
COPY --from=build rootfs/ /
ENTRYPOINT [ "unbound" ]
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD [ "dig", "sigok.verteiltesysteme.net", "@127.0.0.1" ]
LABEL org.opencontainers.image.authors "Kyle Harding <https://klutchell.dev>"
LABEL org.opencontainers.image.url "https://github.com/klutchell/unbound-dnscrypt"
LABEL org.opencontainers.image.documentation "https://github.com/klutchell/unbound-dnscrypt"
LABEL org.opencontainers.image.source "https://github.com/klutchell/unbound-dnscrypt"
LABEL org.opencontainers.image.title "klutchell/unbound-dnscrypt"
LABEL org.opencontainers.image.description "Unbound is a validating, recursive, caching DNS resolver"