mirror of
https://github.com/rancher/os.git
synced 2025-07-20 01:49:04 +00:00
Scripts to build OpenStack/KVM image
This commit is contained in:
parent
ba5e4471b7
commit
01252fc044
1
scripts/images/openstack/.dockerignore
Normal file
1
scripts/images/openstack/.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
dist
|
13
scripts/images/openstack/Dockerfile.dapper
Normal file
13
scripts/images/openstack/Dockerfile.dapper
Normal file
@ -0,0 +1,13 @@
|
||||
FROM debian:jessie
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -y qemu-kvm qemu-utils curl ca-certificates
|
||||
RUN mkdir -p /source/assets
|
||||
|
||||
# Change here to build a specific version
|
||||
ENV VERSION latest
|
||||
|
||||
RUN curl -fL https://releases.rancher.com/os/${VERSION}/rancheros.iso > /source/assets/rancheros.iso
|
||||
CMD ["/source/scripts/build.sh"]
|
||||
|
||||
ENV DAPPER_RUN_ARGS --device /dev/kvm
|
||||
ENV DAPPER_OUTPUT dist
|
9
scripts/images/openstack/README.md
Normal file
9
scripts/images/openstack/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
OpenStack Image
|
||||
===============
|
||||
|
||||
Build by running `dapper` in this folder and the build will produce `./dist/rancheros-openstack.img`. The image produced works with "Configuration Drive" to obtain userdata.
|
||||
|
||||
KVM
|
||||
===
|
||||
|
||||
This build requires a host capable of KVM. If you don't have KVM then remove `ENV DAPPER_RUN_ARGS --device /dev/kvm` from `Dockerfile.dapper`, but it will run very slow.
|
35
scripts/images/openstack/scripts/build.sh
Executable file
35
scripts/images/openstack/scripts/build.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
mkdir -p {dist,build/openstack/latest}
|
||||
|
||||
cat > build/openstack/latest/user_data << EOF
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
trap "poweroff" EXIT
|
||||
|
||||
mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
|
||||
|
||||
touch log
|
||||
openvt -s -- tail -f log &
|
||||
ros install -d /dev/vda -f --no-reboot >log 2>&1
|
||||
|
||||
touch /mnt/success
|
||||
EOF
|
||||
|
||||
rm -f build/{success,hd.img}
|
||||
qemu-img create -f qcow2 build/hd.img 8G
|
||||
kvm -curses \
|
||||
-drive if=virtio,file=build/hd.img \
|
||||
-cdrom assets/rancheros.iso \
|
||||
-m 1024 \
|
||||
-fsdev local,id=conf,security_model=none,path=$(pwd)/build \
|
||||
-device virtio-9p-pci,fsdev=conf,mount_tag=config-2
|
||||
|
||||
[ -f build/success ]
|
||||
|
||||
echo Converting dist/rancheros-openstack.img
|
||||
qemu-img convert -c -O qcow2 build/hd.img dist/rancheros-openstack.img
|
Loading…
Reference in New Issue
Block a user