From feb7951f33bd2dd908bb64e088ece917ad5fb9bb Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Thu, 7 Dec 2017 14:41:14 -0800 Subject: [PATCH] Add docker files for testing on various linux distros Change-Id: Ic05e2dc326a2b70c43132118d78f6d496d8b7e18 --- packager/testing/dockers/ArchLinux_Dockerfile | 27 +++++++++++++++++++ packager/testing/dockers/CentOS_Dockerfile | 13 +++++++++ packager/testing/dockers/Debian_Dockerfile | 12 +++++++++ packager/testing/dockers/Fedora_Dockerfile | 13 +++++++++ packager/testing/dockers/OpenSUSE_Dockerfile | 12 +++++++++ packager/testing/dockers/Ubuntu17_Dockerfile | 12 +++++++++ packager/testing/dockers/Ubuntu_Dockerfile | 12 +++++++++ packager/testing/dockers/test_dockers.sh | 18 +++++++++++++ 8 files changed, 119 insertions(+) create mode 100644 packager/testing/dockers/ArchLinux_Dockerfile create mode 100644 packager/testing/dockers/CentOS_Dockerfile create mode 100644 packager/testing/dockers/Debian_Dockerfile create mode 100644 packager/testing/dockers/Fedora_Dockerfile create mode 100644 packager/testing/dockers/OpenSUSE_Dockerfile create mode 100644 packager/testing/dockers/Ubuntu17_Dockerfile create mode 100644 packager/testing/dockers/Ubuntu_Dockerfile create mode 100755 packager/testing/dockers/test_dockers.sh diff --git a/packager/testing/dockers/ArchLinux_Dockerfile b/packager/testing/dockers/ArchLinux_Dockerfile new file mode 100644 index 0000000000..7648de7d78 --- /dev/null +++ b/packager/testing/dockers/ArchLinux_Dockerfile @@ -0,0 +1,27 @@ +FROM pritunl/archlinux + +# Update, and install basic packages. +RUN pacman -S --needed --noconfirm python2 git curl gcc gcc-libs make fakeroot + +# depot_tools uses python2 instead of python3. +RUN ln -sf python2 /usr/bin/python + +# Install libtinfo.so.5 which is needed by clang. +RUN git clone https://aur.archlinux.org/ncurses5-compat-libs.git /tmp/ncurses-libs +# makepkg need to run from non root user. +RUN useradd -m makepkg_user +RUN chown makepkg_user /tmp/ncurses-libs +USER makepkg_user +WORKDIR /tmp/ncurses-libs +RUN gpg --keyserver pgp.mit.edu --recv-keys F7E48EDB +RUN makepkg +USER root +RUN pacman -U --noconfirm /tmp/ncurses-libs/ncurses5-compat-libs-6.0+20170527-1-x86_64.pkg.tar.xz + +# Install depot_tools. +WORKDIR / +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/CentOS_Dockerfile b/packager/testing/dockers/CentOS_Dockerfile new file mode 100644 index 0000000000..78308fef58 --- /dev/null +++ b/packager/testing/dockers/CentOS_Dockerfile @@ -0,0 +1,13 @@ +FROM centos + +# Update, and install basic packages. +RUN yum install -y git python git curl gcc-c++ findutils bzip2 \ + ncurses-compat-libs libatomic + +# Install depot_tools. +WORKDIR / +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/Debian_Dockerfile b/packager/testing/dockers/Debian_Dockerfile new file mode 100644 index 0000000000..a07da02817 --- /dev/null +++ b/packager/testing/dockers/Debian_Dockerfile @@ -0,0 +1,12 @@ +FROM debian + +# Update, and install basic packages +RUN apt-get update +RUN apt-get install -y build-essential curl git python + +# install depot_tools http://www.chromium.org/developers/how-tos/install-depot-tools +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/Fedora_Dockerfile b/packager/testing/dockers/Fedora_Dockerfile new file mode 100644 index 0000000000..b7892b6f0f --- /dev/null +++ b/packager/testing/dockers/Fedora_Dockerfile @@ -0,0 +1,13 @@ +FROM fedora + +# Update, and install basic packages. +RUN yum install -y git python git curl gcc-c++ findutils bzip2 \ + ncurses-compat-libs libatomic + +# Install depot_tools. +WORKDIR / +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/OpenSUSE_Dockerfile b/packager/testing/dockers/OpenSUSE_Dockerfile new file mode 100644 index 0000000000..1686317d78 --- /dev/null +++ b/packager/testing/dockers/OpenSUSE_Dockerfile @@ -0,0 +1,12 @@ +FROM opensuse + +# Update, and install basic packages. +RUN zypper in -y git python python-xml git curl gcc-c++ tar + +# Install depot_tools. +WORKDIR / +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/Ubuntu17_Dockerfile b/packager/testing/dockers/Ubuntu17_Dockerfile new file mode 100644 index 0000000000..ad358f59e0 --- /dev/null +++ b/packager/testing/dockers/Ubuntu17_Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:17.10 + +# Update, and install basic packages. +RUN apt-get update +RUN apt-get install -y build-essential curl git python + +# Install depot_tools. +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/Ubuntu_Dockerfile b/packager/testing/dockers/Ubuntu_Dockerfile new file mode 100644 index 0000000000..35350e88ee --- /dev/null +++ b/packager/testing/dockers/Ubuntu_Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu + +# Update, and install basic packages. +RUN apt-get update +RUN apt-get install -y build-essential curl git python + +# Install depot_tools. +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +ENV PATH /depot_tools:$PATH + +# Build and run this docker by mapping shaka-packager with +# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/test_dockers.sh b/packager/testing/dockers/test_dockers.sh new file mode 100755 index 0000000000..4f97027334 --- /dev/null +++ b/packager/testing/dockers/test_dockers.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PACKAGER_DIR="$(dirname "$(dirname "$(dirname "$(dirname ${SCRIPT_DIR})")")")" + +function docker_run() { + docker run -v ${PACKAGER_DIR}:/shaka-packager -w /shaka-packager/src my_container "$@" +} + +for docker_file in ${SCRIPT_DIR}/*_Dockerfile ; do + docker build -t my_container -f ${docker_file} ${SCRIPT_DIR} + docker_run gclient runhooks + docker_run ninja -C out/Release + docker_run bash -c 'GYP_DEFINES="clang=0" gclient runhooks' + docker_run ninja -C out/Release +done