pkg: Roll the init package from linuxkit/alpine

We only need the alpine-baselayout packe to run init. This also
removes the sha256 import from alpine:edge.

This also reduces the size of the init package by more than
50% to just 1.5MB.

Also make the HUB org/registry build time configurable.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-05-08 19:51:14 +01:00
parent c1a873b489
commit 72c88872e6
2 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,14 @@
# Use sha256 here to get a fixed version FROM linuxkit/alpine:6336329f15b4166514782eaa555cf0ffd35c519c@sha256:f6c2ce92910b1d6e4e5557850a554f4a3ae9f66c1e89ad86a24d6c6e550f165e AS mirror
FROM alpine:edge@sha256:99588bc8883c955c157d18fc3eaa4a3c1400c223e6c7cabca5f600a3e9f8d5cd 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
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
FROM scratch
ENTRYPOINT [] ENTRYPOINT []
CMD [] CMD []
WORKDIR / WORKDIR /
COPY --from=mirror /out/ /
COPY init / COPY init /
COPY etc etc/ COPY etc etc/

View File

@ -1,14 +1,15 @@
.PHONY: tag push .PHONY: tag push
default: push default: push
ORG?=linuxkit
IMAGE=init IMAGE=init
DEPS=Dockerfile init $(wildcard etc/*) $(wildcard etc/init.d/*) DEPS=Dockerfile init $(wildcard etc/*) $(wildcard etc/init.d/*)
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
tag: $(DEPS) tag: $(DEPS)
docker build --no-cache --network=none -t linuxkit/$(IMAGE):$(HASH) . docker build --no-cache --network=none -t $(ORG)/$(IMAGE):$(HASH) .
push: tag push: tag
docker pull linuxkit/$(IMAGE):$(HASH) || \ docker pull $(ORG)/$(IMAGE):$(HASH) || \
docker push linuxkit/$(IMAGE):$(HASH) docker push $(ORG)/$(IMAGE):$(HASH)