Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
[master] update dockerfile for test install script
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy-Xu committed Nov 22, 2016
1 parent 97a4f18 commit 8d94fc9
Show file tree
Hide file tree
Showing 30 changed files with 637 additions and 64 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hyper
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Install script for Hyper_ client and hypercontainer
Install script for Hyper.sh client and hypercontainer
===================================================

# Usage

## install hypercli for Hyper_
## install hypercli for Hyper.sh

website: https://hyper.sh

Expand All @@ -15,10 +15,14 @@ $ wget -qO- https://hyper.sh/install | bash

## install hypercontainer

website https://hypercontainer.io
website: https://hypercontainer.io

```
$ curl -sSL https://hypercontainer.io/install | bash
or
$ wget -qO- https://hypercontainer.io/install | bash
```

# test install script in container

[DETAIL](docker/README.md)
34 changes: 25 additions & 9 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
Test hyper install script in docker container
=============================================

## Dependency
# Install script test report

| OS | hyper.sh | hypercontainer |
| --- | --- | --- |
| [CentOS7](centos/6) | ok | ok |
| [CentOS6](centos/7) | ok | - |
| [Fefora24](fedora/24) | ok | ok |
| [Fefora23](fedora/23) | ok | ok |
| [Ubuntu16.04(xenial)](ubuntu/xenial) | ok | ok |
| [Ubuntu14.04(trusty)](ubuntu/trusty) | ok | - |
| [Debian8(jessie)](debian/jessie) | ok | ok |
| [Debian7(wheezy)](debian/wheezy) | ok | - |

# Dependency for hypercontainer

- qemu 2+
- libvirt

## Usage
# Test install script in docker container

> example
> For example: test under CentOS 7
```
cd centos
```shell
$ cd centos/7

//build image hyperhq/test-installer-centos:7.2.1511
./util.sh build
$ ./util.sh build

//run container test-installer-centos
./util.sh run
$ ./util.sh run

//test local install script
$ docker exec -it test-installer-centos-7 bash

//install hypercli in container
./util.sh test_hyper
$ ./util.sh test_hyper

//install hypercontainer in container
./util.sh test_hypercontainer
$ ./util.sh test_hypercontainer
```
23 changes: 23 additions & 0 deletions docker/centos/6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# not support hypercontainer
FROM centos:6.8
MAINTAINER Jimmy Xu <[email protected]>

# install common package
RUN yum install -y wget curl git vim ca-certificates \
&& yum clean all

# update qemu to 2.4.1
RUN yum install -y gcc libuuid-devel libaio-devel spice-server-devel zlib-devel \
gnutls-devel cyrus-sasl-devel glib2-devel libaio-devel spice-protocol flex bison libtool \
libcap-devel libattr-devel \
&& yum clean all
ENV QEMU_VER 2.4.1
RUN curl -O http://wiki.qemu-project.org/download/qemu-${QEMU_VER}.tar.bz2 \
&& tar -xjf qemu-${QEMU_VER}.tar.bz2 \
&& cd qemu-${QEMU_VER} \
&& ./configure --prefix=/usr/local/ --target-list=x86_64-softmmu --enable-vnc --disable-xen --enable-vnc-tls --enable-vnc-sasl --enable-kvm --enable-linux-aio --disable-docs --enable-vhost-net --disable-libiscsi --disable-smartcard-nss --enable-debug --enable-uuid --enable-virtfs \
&& make && make install \
&& ln -s /usr/local/bin/qemu-system-x86_64 /usr/bin/qemu-system-x86_64 \
&& rm -rf qemu-${QEMU_VER}.tar.bz2

WORKDIR /hyper-installer
102 changes: 102 additions & 0 deletions docker/centos/6/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash

set -e

repo="hyperhq/test-installer-centos"
tag="6.8"
image=${repo}:${tag}
container="test-installer-centos-6"

# DOCKER0=$(ifconfig | grep docker0 -A1 | grep "inet " | awk '{print $2}')
# PROXY="http://${DOCKER0}:8118"

function build(){
echo "starting build..."
echo "=============================================================="
CMD="docker build --build-arg http_proxy=${PROXY} --build-arg https_proxy=${PROXY} -t ${image} ."
echo "CMD: [ ${CMD} ]"
eval $CMD
}

function push(){
echo -e "\nstarting push [${image}] ..."
echo "=============================================================="
docker push ${image}
}

function run() {
echo -e "\ncheck old conainer from [${image}] ..."
cnt=`docker ps -a --filter="name=${container}" | wc -l`
if [ $cnt -ne 1 ];then
docker rm -fv ${container}
fi
echo -e "\nrun conainer from [${image}] ..."
docker run -d -t \
--privileged \
--hostname ${container} \
--name ${container} \
--env HTTP_PROXY=$HTTP_PROXY --env HTTPS_PROXY=$HTTPS_PROXY \
-v `pwd`/../../../../hyper-installer:/hyper-installer \
$image top
echo "---------------------------------------------------"
docker ps -a --filter="name=${container}"
cat <<EOF
---------------------------------------------------
Run the following command to enter container:
docker exec -it ${container} bash
EOF
}

function test_hyper() {
echo -e "\ncheck conainer from [${image}] ..."
cnt=`docker ps -a --filter="name=${container}" | wc -l`
if [ $cnt -eq 1 ];then
run
fi
docker exec -it ${container} bash -c "curl -sSL https://hyper.sh/install | bash"
}

function test_hypercontainer() {
echo -e "\ncheck conainer from [${image}] ..."
cnt=`docker ps -a --filter="name=${container}" | wc -l`
if [ $cnt -eq 1 ];then
run
fi
docker exec -it ${container} bash -c "curl -sSL https://hypercontainer.io/install | bash"
}

case "$1" in
"build")
build
;;
"push")
build
push
;;
"run")
run
;;
"test_hyper")
test_hyper
;;
"test_hypercontainer")
test_hypercontainer
;;
*)
cat <<EOF
usage:
./util.sh build # build only
./util.sh push # build and push
./util.sh run # run only
./util.sh test_hyper # test install script for hypercli of Hyper.sh
./util.sh test_hypercontainer # test install script for hypercontainer
EOF
exit 1
;;
esac



echo -e "\n=============================================================="
echo "Done!"
7 changes: 7 additions & 0 deletions docker/centos/7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM centos:7.2.1511
MAINTAINER Jimmy Xu <[email protected]>

RUN yum install -y wget curl git vim ca-certificates \
&& yum clean all

WORKDIR /hyper-installer
5 changes: 3 additions & 2 deletions docker/centos/util.sh → docker/centos/7/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
repo="hyperhq/test-installer-centos"
tag="7.2.1511"
image=${repo}:${tag}
container="test-installer-centos"
container="test-installer-centos-7"

# DOCKER0=$(ifconfig | grep docker0 -A1 | grep "inet " | awk '{print $2}')
# PROXY="http://${DOCKER0}:8118"
Expand Down Expand Up @@ -33,9 +33,10 @@ function run() {
echo -e "\nrun conainer from [${image}] ..."
docker run -d -t \
--privileged \
--hostname ${container} \
--name ${container} \
--env HTTP_PROXY=$HTTP_PROXY --env HTTPS_PROXY=$HTTPS_PROXY \
-v `pwd`/../../../hyper-installer:/hyper-installer \
-v `pwd`/../../../../hyper-installer:/hyper-installer \
$image top
echo "---------------------------------------------------"
docker ps -a --filter="name=${container}"
Expand Down
6 changes: 0 additions & 6 deletions docker/centos/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions docker/debian/Dockerfile

This file was deleted.

41 changes: 41 additions & 0 deletions docker/debian/jessie/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM debian:8.5
MAINTAINER Jimmy Xu <[email protected]>

ENV DEBIAN_FRONTEND noninteractive
COPY sources.list.jessie /etc/apt/sources.list

# install common package
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget curl xz-utils git vim ca-certificates
# && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

#####################################################################
# install libvirt0(require libvirt0_1.2.16-2ubuntu11.15.10.3+) #
#####################################################################
## install libdbus-1-3_1.9.20
RUN apt-get install -y libapparmor1 libcap-ng0
RUN cd /root && wget http://launchpadlibrarian.net/215017531/libdbus-1-3_1.9.20-1ubuntu1_amd64.deb \
&& wget http://launchpadlibrarian.net/215017529/dbus_1.9.20-1ubuntu1_amd64.deb \
&& dpkg -i libdbus-1-3_1.9.20-1ubuntu1_amd64.deb dbus_1.9.20-1ubuntu1_amd64.deb
## install libxen-4.5_4.5.1
RUN apt-get install -y libxenstore3.0 libyajl2
RUN cd /root && wget http://launchpadlibrarian.net/216308679/libxen-4.5_4.5.1-0ubuntu1_amd64.deb \
&& dpkg -i libxen-4.5_4.5.1-0ubuntu1_amd64.deb
## install libvirt0_1.2.16-2
RUN apt-get install -y libavahi-client3 libavahi-common3 libnl-3-200 libnuma1 libxml2
RUN cd /root && wget http://launchpadlibrarian.net/234853156/libvirt0_1.2.16-2ubuntu11.15.10.3_amd64.deb \
&& dpkg -i libvirt0_1.2.16-2ubuntu11.15.10.3_amd64.deb

## update dmsetup and libdevmapper
RUN cd /root \
&& wget http://launchpadlibrarian.net/211288612/dmsetup_1.02.99-1ubuntu1_amd64.deb \
&& wget http://launchpadlibrarian.net/211288609/libdevmapper1.02.1_1.02.99-1ubuntu1_amd64.deb \
&& dpkg -i libdevmapper1.02.1_1.02.99-1ubuntu1_amd64.deb \
dmsetup_1.02.99-1ubuntu1_amd64.deb

##########################
# install qemu #
##########################
RUN apt-get install -y qemu

WORKDIR /hyper-installer
5 changes: 3 additions & 2 deletions docker/debian/util.sh → docker/debian/jessie/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
repo="hyperhq/test-installer-debian"
tag="8.5"
image=${repo}:${tag}
container="test-installer-debian"
container="test-installer-debian-jessie"

# DOCKER0=$(ifconfig | grep docker0 -A1 | grep "inet " | awk '{print $2}')
# PROXY="http://${DOCKER0}:8118"
Expand Down Expand Up @@ -33,9 +33,10 @@ function run() {
echo -e "\nrun conainer from [${image}] ..."
docker run -d -t \
--privileged \
--hostname ${container} \
--name ${container} \
--env HTTP_PROXY=$HTTP_PROXY --env HTTPS_PROXY=$HTTPS_PROXY \
-v `pwd`/../../../hyper-installer:/hyper-installer \
-v `pwd`/../../../../hyper-installer:/hyper-installer \
$image top
echo "---------------------------------------------------"
docker ps -a --filter="name=${container}"
Expand Down
29 changes: 29 additions & 0 deletions docker/debian/wheezy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# not support hypercontainer
FROM debian:7.11
MAINTAINER Jimmy Xu <[email protected]>

ENV DEBIAN_FRONTEND noninteractive
COPY sources.list.wheezy /etc/apt/sources.list

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
wget curl git vim ca-certificates
## && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# install qemu 2.3.0
RUN apt-get install -y make bzip2 gcc \
libgnutls-dev libsasl2-dev uuid-dev libglib2.0-dev libaio-dev libspice-server-dev libspice-protocol-dev \
libcap-dev and libattr1-dev
ENV QEMU_VER 2.3.0
RUN curl -O http://wiki.qemu-project.org/download/qemu-${QEMU_VER}.tar.bz2 \
&& tar -xjf qemu-${QEMU_VER}.tar.bz2 \
&& cd qemu-${QEMU_VER} \
&& ./configure --prefix=/usr/local/ --target-list=x86_64-softmmu --enable-vnc --disable-xen --enable-vnc-tls --enable-vnc-sasl --enable-kvm --enable-linux-aio --disable-docs --enable-vhost-net --disable-libiscsi --disable-smartcard-nss --enable-debug --enable-uuid --enable-virtfs \
&& make && make install \
&& ln -s /usr/local/bin/qemu-system-x86_64 /usr/bin/qemu-system-x86_64 \
&& rm -rf qemu-${QEMU_VER}.tar.bz2

# install libvirt0
RUN apt-get install -y libvirt0

WORKDIR /hyper-installer
8 changes: 8 additions & 0 deletions docker/debian/wheezy/sources.list.wheezy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
deb http://mirrors.163.com/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-updates main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ wheezy/updates main non-free contrib
#deb-src http://mirrors.163.com/debian/ wheezy main non-free contrib
#deb-src http://mirrors.163.com/debian/ wheezy-updates main non-free contrib
#deb-src http://mirrors.163.com/debian/ wheezy-backports main non-free contrib
#deb-src http://mirrors.163.com/debian-security/ wheezy/updates main non-free contrib
Loading

0 comments on commit 8d94fc9

Please sign in to comment.