mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 19:05:37 +00:00
Merge pull request #759 from justincormack/toybox
Add some basic shell commands in media image for debug
This commit is contained in:
commit
55a395e2d4
@ -1,4 +1,4 @@
|
||||
FROM scratch
|
||||
FROM mobylinux/toybox-media:d476c196534464ca0dd93f8c765002c13d880a1a
|
||||
|
||||
ADD \
|
||||
alpine/initrd.img \
|
||||
|
9
alpine/base/alpine-build-toybox/Dockerfile
Normal file
9
alpine/base/alpine-build-toybox/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM mobylinux/alpine-build-c:36aecb5cf4738737634140eec9abebe1f6559a39
|
||||
COPY . .
|
||||
# 0.7.2
|
||||
ENV LDFLAGS=--static
|
||||
RUN git clone https://github.com/landley/toybox.git && \
|
||||
cd toybox && git checkout b27d5d9ad0c56014d8661d91f69ee498bbbe4cf9 && \
|
||||
make defconfig
|
||||
WORKDIR /toybox
|
||||
ENTRYPOINT ["/build.sh"]
|
27
alpine/base/alpine-build-toybox/Makefile
Normal file
27
alpine/base/alpine-build-toybox/Makefile
Normal file
@ -0,0 +1,27 @@
|
||||
.PHONY: tag push
|
||||
|
||||
IMAGE=alpine-build-toybox
|
||||
|
||||
default: push
|
||||
|
||||
hash: Dockerfile build.sh
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --entrypoint sh $(IMAGE):build -c 'cat /Dockerfile /build.sh /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > hash
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
|
||||
docker push mobylinux/$(IMAGE):$(shell cat hash))
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
tag: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
clean:
|
||||
rm -f hash
|
||||
|
||||
.DELETE_ON_ERROR:
|
11
alpine/base/alpine-build-toybox/build.sh
Executable file
11
alpine/base/alpine-build-toybox/build.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILES=$@
|
||||
make $FILES > /dev/null
|
||||
[ $# -eq 1 ] && FILES=toybox
|
||||
# TODO symlinks if just use toybox
|
||||
mkdir -p /out/bin
|
||||
mv $FILES /out/bin
|
||||
printf "FROM scratch\nCOPY bin/ bin/\n" > /out/Dockerfile
|
||||
cd /out
|
||||
tar cf - .
|
29
alpine/base/toybox-media/Makefile
Normal file
29
alpine/base/toybox-media/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
.PHONY: tag push
|
||||
|
||||
IMAGE=toybox-media
|
||||
|
||||
default: push
|
||||
|
||||
hash:
|
||||
docker run mobylinux/alpine-build-toybox:9d6a5b75d2c5ba1686f23c333b59cbb56bfc4ccf \
|
||||
ls tar sh find sha1sum | \
|
||||
docker build -q -t $(IMAGE):build -
|
||||
docker run $(IMAGE):build tar cf - bin | docker run -i $(IMAGE):build sha1sum -b - > hash
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
|
||||
docker push mobylinux/$(IMAGE):$(shell cat hash))
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
tag: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
clean:
|
||||
rm -f hash
|
||||
|
||||
.DELETE_ON_ERROR:
|
Loading…
Reference in New Issue
Block a user