From fa9151cc00ae19f6895c28b7b6f939f2aaa3b6fd Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Tue, 30 May 2017 15:16:42 +0100 Subject: [PATCH] tools: Build qemu package from the Alpine base Also use the git tree hash as the hash. Signed-off-by: Rolf Neugebauer --- tools/qemu/Dockerfile | 28 ++++++++++++++++------------ tools/qemu/Makefile | 32 +++++++++----------------------- tools/qemu/repositories | 2 -- 3 files changed, 25 insertions(+), 37 deletions(-) delete mode 100644 tools/qemu/repositories diff --git a/tools/qemu/Dockerfile b/tools/qemu/Dockerfile index fdf734836..5b8324b88 100644 --- a/tools/qemu/Dockerfile +++ b/tools/qemu/Dockerfile @@ -1,15 +1,19 @@ -FROM alpine:edge +FROM linuxkit/alpine:5240cbd9cf371c8211c8f1968e57c51a32098c8f AS mirror +RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ +RUN apk add --no-cache --initdb -p /out \ + alpine-baselayout \ + busybox \ + libarchive-tools \ + qemu-img \ + qemu-system-x86_64 -COPY repositories /etc/apk/ +RUN mkdir -p /out/usr/share/ovmf \ + && cp /usr/share/ovmf/bios.bin /out/usr/share/ovmf/bios.bin +RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache -RUN \ - apk update && apk upgrade && \ - apk add --no-cache \ - libarchive-tools \ - qemu-img \ - qemu-system-arm \ - qemu-system-x86_64 \ - ovmf@testing \ - && true +FROM scratch +ENTRYPOINT [] +CMD [] +WORKDIR / +COPY --from=mirror /out/ / -COPY . . diff --git a/tools/qemu/Makefile b/tools/qemu/Makefile index 081ab654f..0496d8d0e 100644 --- a/tools/qemu/Makefile +++ b/tools/qemu/Makefile @@ -1,29 +1,15 @@ .PHONY: tag push - -BASE=alpine:3.5 -IMAGE=qemu - default: push -hash: Dockerfile repositories - DOCKER_CONTENT_TRUST=1 docker pull $(BASE) - tar cf - $^ | docker build --no-cache -t $(IMAGE):build - - docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat Dockerfile /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@ +ORG?=linuxkit +IMAGE=qemu +DEPS=Dockerfile Makefile -push: hash - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - (docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \ - docker push linuxkit/$(IMAGE):$(shell cat hash)) - docker rmi $(IMAGE):build - rm -f hash +HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') -tag: hash - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) - docker rmi $(IMAGE):build - rm -f hash +tag: $(DEPS) + DOCKER_CONTENT_TRUST=1 docker build --no-cache --network=none -t $(ORG)/$(IMAGE):$(HASH) . -clean: - rm -f hash - -.DELETE_ON_ERROR: +push: tag + docker pull $(ORG)/$(IMAGE):$(HASH) || \ + docker push $(ORG)/$(IMAGE):$(HASH) diff --git a/tools/qemu/repositories b/tools/qemu/repositories deleted file mode 100644 index a276cf86e..000000000 --- a/tools/qemu/repositories +++ /dev/null @@ -1,2 +0,0 @@ -http://dl-cdn.alpinelinux.org/alpine/edge/main -@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing