From ab5bb7564242e4f19ea46b4eb933a4dd2dc07069 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Thu, 18 May 2017 17:22:45 +0100 Subject: [PATCH] pkg: Use tini from alpine base in rngd This makes the package slightly bigger as tini from Alpine is not statically linked but removes the dependency on ./tools/tini Signed-off-by: Rolf Neugebauer --- pkg/rngd/Dockerfile | 20 +++++++++++--------- pkg/rngd/Makefile | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/rngd/Dockerfile b/pkg/rngd/Dockerfile index 592639453..32c386baa 100644 --- a/pkg/rngd/Dockerfile +++ b/pkg/rngd/Dockerfile @@ -1,4 +1,11 @@ -FROM linuxkit/alpine:6336329f15b4166514782eaa555cf0ffd35c519c@sha256:f6c2ce92910b1d6e4e5557850a554f4a3ae9f66c1e89ad86a24d6c6e550f165e AS build +FROM linuxkit/alpine:dae8bcbc6e2cec0a1cc1958dddbc5d6bd3ccf9a0@sha256:02c251d54c4083a596ead8cae92144306b385db0ff961c95a3a620a4c69961ed AS mirror +RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ +RUN apk add --no-cache --initdb -p /out \ + tini +RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache +RUN mkdir -p /out/dev /out/proc /out/sys + +FROM linuxkit/alpine:dae8bcbc6e2cec0a1cc1958dddbc5d6bd3ccf9a0@sha256:02c251d54c4083a596ead8cae92144306b385db0ff961c95a3a620a4c69961ed AS build RUN apk add \ argp-standalone \ automake \ @@ -28,15 +35,10 @@ RUN cd $pkgname-$pkgver && \ make && \ make DESTDIR=/ install && \ strip /usr/sbin/rngd -RUN mkdir -p /tmp/dev /tmp/proc /tmp/sys - -FROM linuxkit/tini:cb32c9b3ceb16505e1d62919cf28c8b52bf6d57e@sha256:1645296b3e155f8cf672f71f8d20b274bf38ee94c39dd1b58f7b18e0163b00b8 +FROM scratch ENTRYPOINT [] WORKDIR / +COPY --from=mirror /out/ / COPY --from=build usr/sbin/rngd usr/sbin/rngd -# Can't create directories, so copy empty dirs from previous context -COPY --from=build tmp/dev dev -COPY --from=build tmp/proc proc -COPY --from=build tmp/sys sys -CMD ["/bin/tini", "/usr/sbin/rngd", "-f"] +CMD ["/sbin/tini", "/usr/sbin/rngd", "-f"] diff --git a/pkg/rngd/Makefile b/pkg/rngd/Makefile index 33601e95f..f574cc8f1 100644 --- a/pkg/rngd/Makefile +++ b/pkg/rngd/Makefile @@ -8,7 +8,7 @@ DEPS=Dockerfile HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') tag: $(DEPS) - docker build --no-cache -t $(ORG)/$(IMAGE):$(HASH) . + docker build --squash --no-cache -t $(ORG)/$(IMAGE):$(HASH) . push: tag DOCKER_CONTENT_TRUST=1 docker pull $(ORG)/$(IMAGE):$(HASH) || \