mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 01:06:27 +00:00
logging: update init scripts to latest version with containerd
Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
This commit is contained in:
parent
c4da8863fd
commit
4a9a5afd03
@ -1,9 +1,6 @@
|
|||||||
FROM alpine:3.5
|
# Use sha256 here to get a fixed version
|
||||||
|
FROM alpine:edge@sha256:99588bc8883c955c157d18fc3eaa4a3c1400c223e6c7cabca5f600a3e9f8d5cd
|
||||||
RUN \
|
ENTRYPOINT []
|
||||||
apk --no-cache update && \
|
CMD []
|
||||||
apk --no-cache upgrade -a && \
|
WORKDIR /
|
||||||
apk --no-cache add \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
@ -1,38 +1,14 @@
|
|||||||
C_COMPILE=linuxkit/c-compile:63b085bbaec1aa7c42a7bd22a4b1c350d900617d@sha256:286e3a729c7a0b1a605ae150235416190f9f430c29b00e65fa50ff73158998e5
|
.PHONY: tag push
|
||||||
START_STOP_DAEMON=sbin/start-stop-daemon
|
|
||||||
|
|
||||||
default: push
|
default: push
|
||||||
|
|
||||||
$(START_STOP_DAEMON): start-stop-daemon.c
|
|
||||||
mkdir -p $(dir $@)
|
|
||||||
tar cf - $^ | docker run --rm --net=none --log-driver=none -i $(C_COMPILE) -o $@ | tar xf -
|
|
||||||
|
|
||||||
.PHONY: tag push
|
|
||||||
|
|
||||||
BASE=alpine:3.5
|
|
||||||
IMAGE=init
|
IMAGE=init
|
||||||
|
DEPS=Dockerfile init $(wildcard etc/*) $(wildcard etc/init.d/*)
|
||||||
|
|
||||||
ETC=$(shell find etc -type f)
|
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||||
|
|
||||||
hash: Dockerfile $(ETC) init $(START_STOP_DAEMON)
|
tag: $(DEPS)
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
docker build --no-cache --network=none -t linuxkit/$(IMAGE):$(HASH) .
|
||||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
|
||||||
docker run --rm $(IMAGE):build sh -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
|
|
||||||
|
|
||||||
push: hash
|
push: tag
|
||||||
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
docker pull linuxkit/$(IMAGE):$(HASH) || \
|
||||||
(docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \
|
docker push linuxkit/$(IMAGE):$(HASH)
|
||||||
docker push linuxkit/$(IMAGE):$(shell cat hash))
|
|
||||||
docker rmi $(IMAGE):build
|
|
||||||
rm -f hash
|
|
||||||
|
|
||||||
tag: hash
|
|
||||||
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 sbin usr
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# start memlogd container
|
|
||||||
|
|
||||||
/usr/bin/startmemlogd
|
|
||||||
|
|
||||||
# start onboot containers, run to completion
|
# start onboot containers, run to completion
|
||||||
|
|
||||||
if [ -d /containers/onboot ]
|
if [ -d /containers/onboot ]
|
||||||
@ -13,7 +9,7 @@ then
|
|||||||
base="$(basename $f)"
|
base="$(basename $f)"
|
||||||
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
||||||
mount -o remount,rw "$f/rootfs"
|
mount -o remount,rw "$f/rootfs"
|
||||||
/usr/bin/logwrite -n "$(basename $f)" /usr/bin/runc run --bundle "$f" "$(basename $f)"
|
/usr/bin/runc run --bundle "$f" "$(basename $f)"
|
||||||
printf " - $base\n"
|
printf " - $base\n"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -28,7 +24,7 @@ then
|
|||||||
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
||||||
mount -o remount,rw "$f/rootfs"
|
mount -o remount,rw "$f/rootfs"
|
||||||
log="/var/log/$base.log"
|
log="/var/log/$base.log"
|
||||||
/usr/bin/logwrite -n "$(basename $f)" /sbin/start-stop-daemon --start --pidfile /run/$base.pid --exec /usr/bin/runc -- run --bundle "$f" --pid-file /run/$base.pid "$(basename $f)" </dev/null 2>$log >$log &
|
ctr run --runtime-config "$f/config.json" --rootfs "$f/rootfs" --id "$(basename $f)" </dev/null 2>$log >$log &
|
||||||
printf " - $base\n"
|
printf " - $base\n"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# mount filesystems
|
# mount filesystems
|
||||||
mkdir -p -m 0755 /proc /run /tmp /sys /dev
|
|
||||||
|
|
||||||
mount -n -t proc proc /proc -o nodev,nosuid,noexec,relatime
|
mount -n -t proc proc /proc -o nodev,nosuid,noexec,relatime
|
||||||
|
|
||||||
mount -n -t tmpfs tmpfs /run -o nodev,nosuid,noexec,relatime,size=10%,mode=755
|
mount -n -t tmpfs tmpfs /run -o nodev,nosuid,noexec,relatime,size=10%,mode=755
|
||||||
@ -83,10 +81,10 @@ then
|
|||||||
hostname -F /etc/hostname
|
hostname -F /etc/hostname
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(hostname) = "moby" -a -f /sys/class/net/eth0/address ]
|
if [ $(hostname) = "(none)" -a -f /sys/class/net/eth0/address ]
|
||||||
then
|
then
|
||||||
mac=$(cat /sys/class/net/eth0/address)
|
mac=$(cat /sys/class/net/eth0/address)
|
||||||
hostname moby-$(echo $mac | sed 's/://g')
|
hostname linuxkit-$(echo $mac | sed 's/://g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set system clock from hwclock
|
# set system clock from hwclock
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user