mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 02:51:55 +00:00
pkg: Roll the sshd package from linuxkit/alpine
Also convert it to a multi-stage build and make the HUB org/registry build time configurable. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
9f6578783b
commit
e950d6e2ac
@ -1,15 +1,21 @@
|
|||||||
FROM alpine:edge
|
FROM linuxkit/alpine:6336329f15b4166514782eaa555cf0ffd35c519c@sha256:f6c2ce92910b1d6e4e5557850a554f4a3ae9f66c1e89ad86a24d6c6e550f165e AS mirror
|
||||||
|
|
||||||
RUN \
|
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
||||||
apk update && apk upgrade && \
|
RUN apk add --no-cache --initdb -p /out \
|
||||||
apk add --no-cache \
|
alpine-baselayout \
|
||||||
openssh-server \
|
busybox \
|
||||||
tini \
|
musl \
|
||||||
util-linux \
|
openssh-server \
|
||||||
&& true
|
tini \
|
||||||
|
util-linux \
|
||||||
COPY . .
|
&& true
|
||||||
|
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
ENTRYPOINT []
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=mirror /out/ /
|
||||||
|
COPY etc/ /etc/
|
||||||
|
COPY usr/ /usr/
|
||||||
RUN mkdir -p /etc/ssh /root/.ssh && chmod 0700 /root/.ssh
|
RUN mkdir -p /etc/ssh /root/.ssh && chmod 0700 /root/.ssh
|
||||||
|
|
||||||
CMD ["/sbin/tini", "/usr/bin/ssh.sh"]
|
CMD ["/sbin/tini", "/usr/bin/ssh.sh"]
|
||||||
|
@ -1,29 +1,15 @@
|
|||||||
.PHONY: tag push
|
.PHONY: tag push
|
||||||
|
|
||||||
BASE=alpine:edge
|
|
||||||
IMAGE=sshd
|
|
||||||
|
|
||||||
default: push
|
default: push
|
||||||
|
|
||||||
hash: Dockerfile etc/ssh/sshd_config usr/bin/ssh.sh etc/motd
|
ORG?=linuxkit
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
IMAGE=sshd
|
||||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
DEPS=Dockerfile etc/motd etc/ssh/sshd_config usr/bin/ssh.sh
|
||||||
docker run --rm $(IMAGE):build sh -c "cat $^ /lib/apk/db/installed | sha1sum" | sed 's/ .*//' > $@
|
|
||||||
|
|
||||||
push: hash
|
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||||
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
|
tag: $(DEPS)
|
||||||
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
docker build --squash --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 pull $(ORG)/$(IMAGE):$(HASH) || \
|
||||||
|
docker push $(ORG)/$(IMAGE):$(HASH)
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
Loading…
Reference in New Issue
Block a user