mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 11:00:25 +00:00
Merge pull request #925 from dgageot/add-gce-specific-script
Add GCE specific script
This commit is contained in:
commit
8c70f94a26
@ -57,6 +57,7 @@ RUN \
|
||||
rc-update add containerd default && \
|
||||
rc-update add aws default && \
|
||||
rc-update add azure default && \
|
||||
rc-update add gcp default && \
|
||||
true
|
||||
|
||||
CMD ["/mkinitrd.sh"]
|
||||
|
@ -19,8 +19,8 @@ PAD4_IMAGE=mobylinux/pad4@sha256:a26e02f16bdafa241a55e05fa09b9bb260e69a3a8c90418
|
||||
# Tag: 74b6ce93033430a58826d90b0b88513e0dcfcb5a
|
||||
TAR2INITRD_IMAGE=mobylinux/tar2initrd@sha256:42e242f5bf8dc7971c1f0e6e7b156008d930d5b3129136e72c4b867f2ff15e98
|
||||
|
||||
# Tag: df1b8ef666d66694e84f23772937ff45c46fa6c1
|
||||
GCE_IMAGE=mobylinux/mkimage-gce@sha256:b19ba24184ed5602df5b666ed475d5d7211fa67bee51d3e6380cf0380c63f65b
|
||||
# Tag: 77bc577875fb3a80ac2d14b70d1daa885bbf199c
|
||||
GCE_IMAGE=mobylinux/mkimage-gce@sha256:f9abf2eae20984b7dd3c1afb700b2c9c41e39e6e7c688c78348a51d0780d74cc
|
||||
|
||||
moby.img: Dockerfile mkinitrd.sh init $(ETCFILES)
|
||||
$(MAKE) -C kernel
|
||||
@ -49,6 +49,7 @@ moby.img: Dockerfile mkinitrd.sh init $(ETCFILES)
|
||||
-C packages/containerd etc -C ../.. \
|
||||
-C packages/aws etc -C ../.. \
|
||||
-C packages/azure etc -C ../.. \
|
||||
-C packages/gcp etc -C ../.. \
|
||||
| \
|
||||
docker build -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
|
||||
echo $$BUILD > mobylinux.tag && \
|
||||
@ -87,7 +88,7 @@ gce.img.tar.gz: common
|
||||
docker run --rm --net=none --log-driver=none -i $(GCE_IMAGE) >$@
|
||||
|
||||
gce-upload:
|
||||
docker run -it --rm --volumes-from gcloud-config google/cloud-sdk gsutil cp gce.img.tar.gz gs://docker4x-moby-images/
|
||||
docker run -it --rm --volumes-from gcloud-config google/cloud-sdk gsutil cp -a public-read gce.img.tar.gz gs://docker-for-gcp-images/
|
||||
|
||||
common: initrd.img
|
||||
$(MAKE) -C kernel
|
||||
|
@ -2,4 +2,4 @@ DEFAULT linux
|
||||
LABEL linux
|
||||
KERNEL /vmlinuz64
|
||||
INITRD /initrd.img
|
||||
APPEND earlyprintk=ttyS0,115200 console=ttyS0,115200
|
||||
APPEND earlyprintk=ttyS0,115200 console=ttyS0,115200 mobyplatform=gcp
|
||||
|
@ -86,6 +86,10 @@ start()
|
||||
cat /etc/docker/daemon.json | jq -e 'has("experimental")' > /dev/null || DOCKER_OPTS="${DOCKER_OPTS} --experimental"
|
||||
fi
|
||||
|
||||
# On GCP, send logs to Google Cloud Logging
|
||||
# Disabled because of https://github.com/docker/docker/issues/29344
|
||||
# [ $(mobyplatform) = "gcp" ] && DOCKER_OPTS="${DOCKER_OPTS} --log-driver=gcplogs"
|
||||
|
||||
# choose storage driver
|
||||
if ! $(cat /etc/docker/daemon.json | jq -e '."storage-driver"' > /dev/null)
|
||||
then
|
||||
|
29
alpine/packages/gcp/etc/init.d/gcp
Executable file
29
alpine/packages/gcp/etc/init.d/gcp
Executable file
@ -0,0 +1,29 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Bootstrap procedure if running on Docker GCP edition"
|
||||
|
||||
depend()
|
||||
{
|
||||
need docker
|
||||
need net
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
[ "$(mobyplatform)" != "gcp" ] && exit 0
|
||||
ebegin "Running GCP-specific initialization"
|
||||
|
||||
ebegin "Run startup script"
|
||||
|
||||
temp_file=$(mktemp)
|
||||
curl -s http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script -H "Metadata-Flavor: Google" > ${temp_file}
|
||||
[ -s "${temp_file}" ] && sh "${temp_file}"
|
||||
rm -f "${temp_file}"
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
[ "$(mobyplatform)" != "gcp" ] && exit 0
|
||||
}
|
Loading…
Reference in New Issue
Block a user