mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 11:44:44 +00:00
tests: Use the Alpine base image for the poweroff package
Also convert it to use the git tree hash Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
551d3dcf3a
commit
95b13501f2
@ -1,4 +1,12 @@
|
|||||||
FROM alpine:3.5
|
FROM linuxkit/alpine:451603daf499e3a40308dbf5571dcffed2343ffa AS mirror
|
||||||
ADD . ./
|
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
|
||||||
|
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
CMD []
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=mirror /out/ /
|
||||||
|
COPY /poweroff.sh /poweroff.sh
|
||||||
ENTRYPOINT ["/bin/sh", "/poweroff.sh"]
|
ENTRYPOINT ["/bin/sh", "/poweroff.sh"]
|
||||||
LABEL org.mobyproject.config='{"pid": "host", "readonly": true, "capabilities": ["CAP_SYS_BOOT"]}'
|
LABEL org.mobyproject.config='{"pid": "host", "readonly": true, "capabilities": ["CAP_SYS_BOOT"]}'
|
||||||
|
@ -1,29 +1,15 @@
|
|||||||
.PHONY: tag push
|
.PHONY: tag push
|
||||||
|
|
||||||
BASE=alpine:3.5
|
|
||||||
IMAGE=poweroff
|
|
||||||
|
|
||||||
default: push
|
default: push
|
||||||
|
|
||||||
hash: Dockerfile poweroff.sh
|
ORG?=linuxkit
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
IMAGE=poweroff
|
||||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
DEPS=Dockerfile Makefile poweroff.sh
|
||||||
docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c "cat $^ /lib/apk/db/installed | sha1sum" | sed 's/ .*//' > hash
|
|
||||||
|
|
||||||
push: hash
|
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||||
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
|
tag: $(DEPS)
|
||||||
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
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_CONTENT_TRUST=1 docker pull $(ORG)/$(IMAGE):$(HASH) || \
|
||||||
|
DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(HASH)
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
Loading…
Reference in New Issue
Block a user