tools: Build qemu package from the Alpine base

Also use the git tree hash as the hash.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-05-30 15:16:42 +01:00
parent 63d5031035
commit fa9151cc00
3 changed files with 25 additions and 37 deletions

View File

@ -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 \ FROM scratch
apk update && apk upgrade && \ ENTRYPOINT []
apk add --no-cache \ CMD []
libarchive-tools \ WORKDIR /
qemu-img \ COPY --from=mirror /out/ /
qemu-system-arm \
qemu-system-x86_64 \
ovmf@testing \
&& true
COPY . .

View File

@ -1,29 +1,15 @@
.PHONY: tag push .PHONY: tag push
BASE=alpine:3.5
IMAGE=qemu
default: push default: push
hash: Dockerfile repositories ORG?=linuxkit
DOCKER_CONTENT_TRUST=1 docker pull $(BASE) IMAGE=qemu
tar cf - $^ | docker build --no-cache -t $(IMAGE):build - DEPS=Dockerfile Makefile
docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat Dockerfile /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
push: hash HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
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
tag: hash tag: $(DEPS)
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ DOCKER_CONTENT_TRUST=1 docker build --no-cache --network=none -t $(ORG)/$(IMAGE):$(HASH) .
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean: push: tag
rm -f hash docker pull $(ORG)/$(IMAGE):$(HASH) || \
docker push $(ORG)/$(IMAGE):$(HASH)
.DELETE_ON_ERROR:

View File

@ -1,2 +0,0 @@
http://dl-cdn.alpinelinux.org/alpine/edge/main
@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing