mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-29 21:03:03 +00:00
commit
1295bd50f7
@ -16,4 +16,4 @@ before_script:
|
|||||||
- ".ci/setup.sh"
|
- ".ci/setup.sh"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ".ci/run.sh"
|
- "travis_wait .ci/run.sh"
|
||||||
|
1
rootfs-builder/.gitignore
vendored
Normal file
1
rootfs-builder/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Dockerfile
|
@ -1 +0,0 @@
|
|||||||
FROM centos:7
|
|
6
rootfs-builder/centos/Dockerfile.in
Normal file
6
rootfs-builder/centos/Dockerfile.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
From centos:@OS_VERSION@
|
||||||
|
|
||||||
|
RUN yum -y update && yum install -y git make gcc
|
||||||
|
|
||||||
|
# This will install the proper golang to build Kata components
|
||||||
|
@INSTALL_GO@
|
@ -1,3 +0,0 @@
|
|||||||
From fedora:27
|
|
||||||
|
|
||||||
RUN dnf -y update && dnf install -y git golang systemd pkgconfig
|
|
6
rootfs-builder/clearlinux/Dockerfile.in
Normal file
6
rootfs-builder/clearlinux/Dockerfile.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
From fedora:27
|
||||||
|
|
||||||
|
RUN dnf -y update && dnf install -y git systemd pkgconfig gcc
|
||||||
|
|
||||||
|
# This will install the proper golang to build Kata components
|
||||||
|
@INSTALL_GO@
|
@ -1 +0,0 @@
|
|||||||
FROM euleros:2.2
|
|
5
rootfs-builder/euleros/Dockerfile.in
Normal file
5
rootfs-builder/euleros/Dockerfile.in
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM euleros:@OS_VERSION@
|
||||||
|
|
||||||
|
RUN yum -y update && yum install -y yum git make gcc
|
||||||
|
# This will install the proper golang to build Kata components
|
||||||
|
@INSTALL_GO@
|
@ -6,7 +6,7 @@
|
|||||||
# Remove them or add more
|
# Remove them or add more
|
||||||
|
|
||||||
# EulerOS Version
|
# EulerOS Version
|
||||||
OS_VERSION=${OS_VERSION:-2}
|
OS_VERSION=${OS_VERSION:-2.2}
|
||||||
|
|
||||||
#Mandatory Packages that must be installed
|
#Mandatory Packages that must be installed
|
||||||
# systemd: An init system that will start kata-agent
|
# systemd: An init system that will start kata-agent
|
||||||
|
@ -27,8 +27,8 @@ logfile=/var/log/yum-euleros.log
|
|||||||
exactarch=1
|
exactarch=1
|
||||||
|
|
||||||
[Base]
|
[Base]
|
||||||
name=EulerOS-2.2 Base
|
name=EulerOS-${OS_VERSION} Base
|
||||||
baseurl=http://developer.huawei.com/ict/site-euleros/euleros/repo/yum/2.2/os/x86_64/
|
baseurl=http://developer.huawei.com/ict/site-euleros/euleros/repo/yum/${OS_VERSION}/os/x86_64/
|
||||||
enabled=1
|
enabled=1
|
||||||
gpgcheck=1
|
gpgcheck=1
|
||||||
gpgkey=file://${CONFIG_DIR}/RPM-GPG-KEY-EulerOS
|
gpgkey=file://${CONFIG_DIR}/RPM-GPG-KEY-EulerOS
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
From fedora:27
|
|
||||||
|
|
||||||
RUN dnf -y update && dnf install -y git golang redhat-release systemd pkgconfig
|
|
6
rootfs-builder/fedora/Dockerfile.in
Normal file
6
rootfs-builder/fedora/Dockerfile.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
From fedora:@OS_VERSION@
|
||||||
|
|
||||||
|
RUN dnf -y update && dnf install -y git redhat-release systemd pkgconfig gcc
|
||||||
|
|
||||||
|
# This will install the proper golang to build Kata components
|
||||||
|
@INSTALL_GO@
|
@ -26,11 +26,12 @@ installonly_limit=3
|
|||||||
#Dont use the default dnf reposdir
|
#Dont use the default dnf reposdir
|
||||||
#this will prevent to use host repositories
|
#this will prevent to use host repositories
|
||||||
reposdir=/root/mash
|
reposdir=/root/mash
|
||||||
|
retries=5
|
||||||
|
|
||||||
[kata]
|
[kata]
|
||||||
name=Fedora \$releasever - \$basearch
|
name=Fedora ${OS_VERSION} - \$basearch
|
||||||
failovermethod=priority
|
failovermethod=priority
|
||||||
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-\$releasever&arch=\$basearch
|
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-${OS_VERSION}&arch=\$basearch
|
||||||
enabled=1
|
enabled=1
|
||||||
gpgcheck=0
|
gpgcheck=0
|
||||||
EOF
|
EOF
|
||||||
|
@ -12,6 +12,9 @@ ROOTFS_DIR=${ROOTFS_DIR:-${PWD}/rootfs}
|
|||||||
AGENT_VERSION=${AGENT_VERSION:-master}
|
AGENT_VERSION=${AGENT_VERSION:-master}
|
||||||
GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent}
|
GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent}
|
||||||
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
||||||
|
#Load default vesions for golang and other componets
|
||||||
|
source "${script_dir}/versions.txt"
|
||||||
|
|
||||||
# Name of file that will implement build_rootfs
|
# Name of file that will implement build_rootfs
|
||||||
typeset -r LIB_SH="rootfs_lib.sh"
|
typeset -r LIB_SH="rootfs_lib.sh"
|
||||||
|
|
||||||
@ -79,6 +82,27 @@ check_function_exist() {
|
|||||||
[ "$(type -t ${function_name})" == "function" ] || die "${function_name} function was not defined"
|
[ "$(type -t ${function_name})" == "function" ] || die "${function_name} function was not defined"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_dockerfile() {
|
||||||
|
dir="$1"
|
||||||
|
|
||||||
|
readonly install_go="
|
||||||
|
ADD https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz /tmp
|
||||||
|
RUN tar -C /usr/ -xzf /tmp/go${GO_VERSION}.linux-amd64.tar.gz
|
||||||
|
ENV GOROOT=/usr/go
|
||||||
|
ENV PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
|
||||||
|
"
|
||||||
|
|
||||||
|
readonly dockerfile_template="Dockerfile.in"
|
||||||
|
[ -d "${dir}" ] || die "${dir}: not a directory"
|
||||||
|
pushd ${dir}
|
||||||
|
[ -f "${dockerfile_template}" ] || die "${dockerfile_template}: file not found"
|
||||||
|
sed \
|
||||||
|
-e "s|@OS_VERSION@|${OS_VERSION}|g" \
|
||||||
|
-e "s|@INSTALL_GO@|${install_go//$'\n'/\\n}|g" \
|
||||||
|
${dockerfile_template} > Dockerfile
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while getopts c:hr: opt
|
while getopts c:hr: opt
|
||||||
do
|
do
|
||||||
@ -110,6 +134,7 @@ check_function_exist "build_rootfs"
|
|||||||
if [ -n "${USE_DOCKER}" ] ; then
|
if [ -n "${USE_DOCKER}" ] ; then
|
||||||
image_name="${distro}-rootfs-osbuilder"
|
image_name="${distro}-rootfs-osbuilder"
|
||||||
|
|
||||||
|
generate_dockerfile "${distro_config_dir}"
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg http_proxy="${http_proxy}" \
|
--build-arg http_proxy="${http_proxy}" \
|
||||||
--build-arg https_proxy="${https_proxy}" \
|
--build-arg https_proxy="${https_proxy}" \
|
||||||
|
11
rootfs-builder/template/Dockerfile.template
Normal file
11
rootfs-builder/template/Dockerfile.template
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#@distro@: docker image to be used to create a rootfs
|
||||||
|
#@OS_VERSION@: Docker image version to build this dockerfile
|
||||||
|
from @distro@:@OS_VERSION@
|
||||||
|
|
||||||
|
# This dockerfile needs to provide all the componets need to build a rootfs
|
||||||
|
# Install any package need to create a rootfs (package manager, extra tools)
|
||||||
|
|
||||||
|
# RUN commands
|
||||||
|
|
||||||
|
# This will install the proper golang to build Kata components
|
||||||
|
@INSTALL_GO@
|
@ -13,3 +13,8 @@ endif
|
|||||||
mkdir -p $(DESTDIR)
|
mkdir -p $(DESTDIR)
|
||||||
cp "$(MK_DIR)/rootfs_lib_template.sh" "$(DESTDIR)/rootfs_lib.sh"
|
cp "$(MK_DIR)/rootfs_lib_template.sh" "$(DESTDIR)/rootfs_lib.sh"
|
||||||
cp "$(MK_DIR)/config_template.sh" "$(DESTDIR)/config.sh"
|
cp "$(MK_DIR)/config_template.sh" "$(DESTDIR)/config.sh"
|
||||||
|
sed \
|
||||||
|
-e "s|@distro@|$(ROOTFS_BASE_NAME)|g" \
|
||||||
|
Dockerfile.template > $(DESTDIR)/Dockerfile.in
|
||||||
|
|
||||||
|
|
||||||
|
1
rootfs-builder/versions.txt
Normal file
1
rootfs-builder/versions.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
GO_VERSION=1.9.2
|
@ -28,7 +28,7 @@ function build_image()
|
|||||||
distro="$1"
|
distro="$1"
|
||||||
[ -n "$distro" ]
|
[ -n "$distro" ]
|
||||||
local rootfs="${tmp_dir}/rootfs-osbuilder"
|
local rootfs="${tmp_dir}/rootfs-osbuilder"
|
||||||
sudo -E ${rootfs_sh} -r "${rootfs}" fedora
|
sudo -E ${rootfs_sh} -r "${rootfs}" "${distro}"
|
||||||
sudo ${image_builder_sh} -s ${image_size} -o "${tmp_dir}/image.img" "${rootfs}"
|
sudo ${image_builder_sh} -s ${image_size} -o "${tmp_dir}/image.img" "${rootfs}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user