mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
pkg: Convert dhcpcd to use the Alpine base image and git tree hash
This builds the dhcpcd package from a fixed Alpine 3.5 base and adds the dhcpcd daemon from the Alpine base image. This should make the build reproducible and allows us to use the git tree hash. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
aea6d6c54e
commit
e929205c31
@ -1,12 +1,13 @@
|
||||
FROM alpine:3.5
|
||||
FROM linuxkit/alpine:f0169b60fb260d74025496ae6fd93213fecaba8f@sha256:23743c7206ebe8a609442c5ac7084a26ed45ce8f5213960428bca264225849f1 AS mirror
|
||||
|
||||
RUN \
|
||||
apk update && apk upgrade -a && \
|
||||
apk add --no-cache \
|
||||
dhcpcd \
|
||||
openrc \
|
||||
&& true
|
||||
FROM alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8
|
||||
COPY --from=mirror /etc/apk/repositories /etc/apk/repositories
|
||||
COPY --from=mirror /etc/apk/keys /etc/apk/keys/
|
||||
COPY --from=mirror /mirror /mirror/
|
||||
|
||||
RUN apk add dhcpcd
|
||||
|
||||
RUN rm -rf /mirror /etc/apk/repositories /etc/apk/keys
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf"]
|
||||
|
@ -1,34 +1,14 @@
|
||||
.PHONY: tag push clean container
|
||||
.PHONY: tag push
|
||||
default: push
|
||||
|
||||
IMAGE=dhcpcd
|
||||
DEPS=Dockerfile Makefile dhcpcd.conf usr/lib/dhcpcd/dhcpcd-hooks/10-mtu
|
||||
|
||||
BASE=alpine:3.5
|
||||
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||
|
||||
DEPS=dhcpcd.conf usr/lib/dhcpcd/dhcpcd-hooks/10-mtu
|
||||
tag: $(DEPS)
|
||||
docker build --squash --no-cache --network=none -t linuxkit/$(IMAGE):$(HASH) .
|
||||
|
||||
container: Dockerfile $(DEPS)
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
|
||||
hash: Dockerfile $(DEPS)
|
||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm $(IMAGE):build sh -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > hash
|
||||
|
||||
push: hash container
|
||||
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 container
|
||||
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 -rf hash
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
push: tag
|
||||
docker pull linuxkit/$(IMAGE):$(HASH) || \
|
||||
docker push linuxkit/$(IMAGE):$(HASH)
|
||||
|
Loading…
Reference in New Issue
Block a user