mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
test-kernel-config: Rework for multistage build and package.mk
Network is required to fetch the check script. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
b8f7b7aad0
commit
77c5bd021d
@ -1,6 +1,12 @@
|
||||
FROM alpine:3.5
|
||||
RUN apk update && apk upgrade && apk add --no-cache bash
|
||||
ADD https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh /check-config.sh
|
||||
ADD . ./
|
||||
FROM linuxkit/alpine:34af9cb1990debd17fae6d4198c62ce3910d9908 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 musl bash
|
||||
|
||||
ADD https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh /out/check-config.sh
|
||||
ADD . ./out
|
||||
|
||||
FROM scratch
|
||||
COPY --from=mirror /out /
|
||||
ENTRYPOINT ["/bin/sh", "/check.sh"]
|
||||
LABEL org.mobyproject.config='{"readonly": true, "binds": ["/lib/modules:/lib/modules", "/dev:/dev", "/sys:/sys"], "capabilities": ["all"]}'
|
||||
|
@ -1,29 +1,5 @@
|
||||
.PHONY: tag push
|
||||
|
||||
BASE=alpine:3.5
|
||||
IMAGE=test-kernel-config
|
||||
DEPS=$(wildcard *.sh)
|
||||
NETWORK=1
|
||||
|
||||
default: push
|
||||
|
||||
hash: Dockerfile check.sh check-kernel-config.sh
|
||||
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 $^ /lib/apk/db/installed | sha1sum" | sed 's/ .*//' > hash
|
||||
|
||||
push: hash
|
||||
DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
||||
(docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \
|
||||
DOCKER_CONTENT_TRUST=1 docker push linuxkit/$(IMAGE):$(shell cat hash))
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
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
|
||||
|
||||
clean:
|
||||
rm -f hash
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
include ../../../pkg/package.mk
|
||||
|
Loading…
Reference in New Issue
Block a user