mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
tools: Remove c-compile from toybox-media
Directly install the required packages from the Alpine base image to compile the toybox-media package. Also use the git tree hash for the package hash while at it. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
046afdda48
commit
ff45e154e9
@ -1,12 +1,18 @@
|
|||||||
FROM linuxkit/c-compile:f52f485825c890d581e82a62af6906c1d33d8e5d@sha256:473fd283a090d3546e93915adacf00c69a23ff615c95c968c4a40e8723985853 AS toybox-build
|
FROM linuxkit/alpine:c5021a113803f7608e3908014d316c3490183d0b@sha256:4c7a80173c71ca5019dc56f40442b3a8345f141dd46593bd1fe6d130294d07cb AS build
|
||||||
COPY . .
|
RUN apk add \
|
||||||
|
bash \
|
||||||
|
gcc \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
musl-dev
|
||||||
|
|
||||||
ENV FILES="ls tar sh find sha1sum"
|
ENV FILES="ls tar sh find sha1sum"
|
||||||
# 0.7.2
|
# 0.7.2
|
||||||
ENV LDFLAGS=--static
|
ENV LDFLAGS=--static
|
||||||
RUN git clone https://github.com/landley/toybox.git && \
|
RUN git clone https://github.com/landley/toybox.git && \
|
||||||
cd toybox && git checkout b27d5d9ad0c56014d8661d91f69ee498bbbe4cf9 && \
|
cd toybox && git checkout b27d5d9ad0c56014d8661d91f69ee498bbbe4cf9
|
||||||
make defconfig
|
|
||||||
WORKDIR /toybox
|
WORKDIR /toybox
|
||||||
|
RUN make defconfig
|
||||||
RUN make ${FILES}
|
RUN make ${FILES}
|
||||||
RUN mkdir -p /out/bin
|
RUN mkdir -p /out/bin
|
||||||
RUN cp ${FILES} /out/bin
|
RUN cp ${FILES} /out/bin
|
||||||
@ -15,4 +21,4 @@ FROM scratch
|
|||||||
ENTRYPOINT []
|
ENTRYPOINT []
|
||||||
CMD []
|
CMD []
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=toybox-build out/bin bin/
|
COPY --from=build out/bin bin/
|
||||||
|
@ -2,39 +2,13 @@
|
|||||||
default: push
|
default: push
|
||||||
|
|
||||||
IMAGE=toybox-media
|
IMAGE=toybox-media
|
||||||
BASE=linuxkit/c-compile:f52f485825c890d581e82a62af6906c1d33d8e5d
|
DEPS=Dockerfile
|
||||||
SHA_IMAGE=alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8
|
|
||||||
DEPS=Dockerfile Makefile
|
|
||||||
|
|
||||||
hash: $(DEPS)
|
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
|
||||||
find $^ -type f | xargs cat | docker run --rm -i $(SHA_IMAGE) sha1sum - | sed 's/ .*//' > hash
|
|
||||||
|
|
||||||
tag: hash
|
tag: $(DEPS)
|
||||||
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
docker build --no-cache -t linuxkit/$(IMAGE):$(HASH) .
|
||||||
(docker build --no-cache -t $(IMAGE):build . && \
|
|
||||||
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash))
|
|
||||||
|
|
||||||
push: tag
|
push: tag
|
||||||
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(HASH) || \
|
||||||
docker push linuxkit/$(IMAGE):$(shell cat hash)
|
DOCKER_CONTENT_TRUST=1 docker push linuxkit/$(IMAGE):$(HASH)
|
||||||
rm -f hash
|
|
||||||
docker rmi $(IMAGE):build || true
|
|
||||||
|
|
||||||
signed-tag: hash
|
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
|
||||||
(DOCKER_CONTENT_TRUST=1 docker pull $(BASE) && \
|
|
||||||
docker build --no-cache -t $(IMAGE):build . && \
|
|
||||||
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash))
|
|
||||||
|
|
||||||
sign: signed-tag
|
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
|
||||||
DOCKER_CONTENT_TRUST=1 docker push linuxkit/$(IMAGE):$(shell cat hash)
|
|
||||||
rm -f hash
|
|
||||||
docker rmi $(IMAGE):build || true
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f hash
|
|
||||||
docker rmi $(IMAGE):build || true
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
Loading…
Reference in New Issue
Block a user