From 046afdda48d3c9f200730f1a00411a6139237946 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Fri, 5 May 2017 11:01:57 +0100 Subject: [PATCH] tools: Remove c-compile from tini Use the alpine base image and install the tools to compile tini manually. This removes the dependency on c-compile. Also use the git tree hash for the package hash while at it. Signed-off-by: Rolf Neugebauer --- tools/tini/Dockerfile | 12 +++++++++--- tools/tini/Makefile | 38 ++++++-------------------------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/tools/tini/Dockerfile b/tools/tini/Dockerfile index 8250d6c7e..e33216be2 100644 --- a/tools/tini/Dockerfile +++ b/tools/tini/Dockerfile @@ -1,5 +1,11 @@ -FROM linuxkit/c-compile:f52f485825c890d581e82a62af6906c1d33d8e5d@sha256:473fd283a090d3546e93915adacf00c69a23ff615c95c968c4a40e8723985853 AS tini-build -COPY . / +FROM linuxkit/alpine:c5021a113803f7608e3908014d316c3490183d0b@sha256:4c7a80173c71ca5019dc56f40442b3a8345f141dd46593bd1fe6d130294d07cb AS build +RUN apk add \ + cmake \ + gcc \ + make \ + musl-dev \ + vim + ENV TINI_VERSION=0.13.0 ADD https://github.com/krallin/tini/archive/v${TINI_VERSION}.tar.gz tini-${TINI_VERSION}.tar.gz @@ -10,4 +16,4 @@ FROM scratch ENTRYPOINT [] CMD [] WORKDIR / -COPY --from=tini-build bin/tini bin/tini +COPY --from=build bin/tini bin/tini diff --git a/tools/tini/Makefile b/tools/tini/Makefile index bdda245b5..a60bdd892 100644 --- a/tools/tini/Makefile +++ b/tools/tini/Makefile @@ -2,39 +2,13 @@ default: push IMAGE=tini -BASE=linuxkit/c-compile:f52f485825c890d581e82a62af6906c1d33d8e5d -SHA_IMAGE=alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 -DEPS=Dockerfile Makefile +DEPS=Dockerfile -hash: $(DEPS) - DOCKER_CONTENT_TRUST=1 docker pull $(BASE) - find $^ -type f | xargs cat | docker run --rm -i $(SHA_IMAGE) sha1sum - | sed 's/ .*//' > hash +HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') -tag: hash - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - (docker build --no-cache -t $(IMAGE):build . && \ - docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)) +tag: $(DEPS) + docker build --no-cache --network=none -t linuxkit/$(IMAGE):$(HASH) . push: tag - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - docker push linuxkit/$(IMAGE):$(shell cat hash) - rm -f hash - docker rmi $(IMAGE):build || true - -signed-tag: hash - DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - (DOCKER_CONTENT_TRUST=1 docker pull $(BASE) && \ - docker build --no-cache -t $(IMAGE):build . && \ - docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)) - -sign: signed-tag - DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - DOCKER_CONTENT_TRUST=1 docker push linuxkit/$(IMAGE):$(shell cat hash) - rm -f hash - docker rmi $(IMAGE):build || true - -clean: - rm -f hash - docker rmi $(IMAGE):build || true - -.DELETE_ON_ERROR: + DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(HASH) || \ + DOCKER_CONTENT_TRUST=1 docker push linuxkit/$(IMAGE):$(HASH)