From c9c095f2022f55f176f9b9e2b88fa24e761160ba Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Wed, 1 Jun 2016 21:28:32 -0700 Subject: [PATCH] Build script --- Dockerfile.dapper | 70 ++++++++++++++++++++--------- images/01-base/Dockerfile | 5 ++- images/02-console/console.sh | 1 + images/02-extras/Dockerfile | 3 -- images/02-extras/extra.sh | 18 -------- images/02-headers/Dockerfile | 3 -- images/02-headers/headers.sh | 19 -------- images/03-rescue/Dockerfile | 2 - images/10-centosconsole/Dockerfile | 25 ----------- images/10-centosconsole/prebuild.sh | 12 ----- images/10-centosconsole/prompt.sh | 1 - images/10-debianconsole/Dockerfile | 24 ---------- images/10-debianconsole/prebuild.sh | 12 ----- images/10-fedoraconsole/Dockerfile | 25 ----------- images/10-fedoraconsole/prebuild.sh | 12 ----- images/10-fedoraconsole/prompt.sh | 1 - images/10-resizefs/Dockerfile | 7 --- images/10-resizefs/resizefs.sh | 22 --------- images/10-selinuxtools/Dockerfile | 29 ------------ images/10-selinuxtools/prebuild.sh | 12 ----- images/10-selinuxtools/prompt.sh | 1 - images/10-ubuntuconsole/Dockerfile | 24 ---------- images/10-ubuntuconsole/prebuild.sh | 12 ----- images/20-desktop/Dockerfile | 2 - images/20-desktop/prebuild.sh | 12 ----- scripts/build-images | 47 +++++++------------ scripts/prepare | 4 +- 27 files changed, 70 insertions(+), 335 deletions(-) delete mode 100644 images/02-extras/Dockerfile delete mode 100755 images/02-extras/extra.sh delete mode 100644 images/02-headers/Dockerfile delete mode 100755 images/02-headers/headers.sh delete mode 100644 images/03-rescue/Dockerfile delete mode 100644 images/10-centosconsole/Dockerfile delete mode 100755 images/10-centosconsole/prebuild.sh delete mode 100644 images/10-centosconsole/prompt.sh delete mode 100644 images/10-debianconsole/Dockerfile delete mode 100755 images/10-debianconsole/prebuild.sh delete mode 100644 images/10-fedoraconsole/Dockerfile delete mode 100755 images/10-fedoraconsole/prebuild.sh delete mode 100644 images/10-fedoraconsole/prompt.sh delete mode 100644 images/10-resizefs/Dockerfile delete mode 100755 images/10-resizefs/resizefs.sh delete mode 100644 images/10-selinuxtools/Dockerfile delete mode 100755 images/10-selinuxtools/prebuild.sh delete mode 100644 images/10-selinuxtools/prompt.sh delete mode 100644 images/10-ubuntuconsole/Dockerfile delete mode 100755 images/10-ubuntuconsole/prebuild.sh delete mode 100644 images/20-desktop/Dockerfile delete mode 100755 images/20-desktop/prebuild.sh diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 0c2ffe52..6c22999b 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -47,8 +47,10 @@ ARG OS_REPO=rancher ARG HOSTNAME_DEFAULT=rancher ARG DISTRIB_ID=RancherOS -ARG DOCKER_VERSION=1.11.1 -ARG DOCKER_PATCH_VERSION=v${DOCKER_VERSION}-ros2 +ARG DOCKER_VERSION=1.11.2 +ARG DOCKER_PATCH_VERSION=v${DOCKER_VERSION}-ros1 +ARG DOCKER_BUILD_VERSION=1.10.3 +ARG DOCKER_BUILD_PATCH_VERSION=v${DOCKER_BUILD_VERSION}-ros1 ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.2/policy.29 ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.4.0-23.41-rancher/linux-4.4.10-rancher-x86.tar.gz @@ -58,6 +60,10 @@ ARG DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_ ARG DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm.tgz ARG DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm64.tgz +ARG BUILD_DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_BUILD_VERSION} +ARG BUILD_DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm +ARG BUILD_DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm64 + ARG TOOLCHAIN_arm64=aarch64-linux-gnu ARG TOOLCHAIN_arm=arm-linux-gnueabihf @@ -68,25 +74,51 @@ ARG OS_SERVICES_REPO=https://raw.githubusercontent.com/${OS_REPO}/os-services ARG IMAGE_NAME=${OS_REPO}/os ARG DFS_IMAGE=${OS_REPO}/docker:v${DOCKER_VERSION} -ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2016.02/os-base_amd64.tar.xz -ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2016.02/os-base_arm64.tar.xz -ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.02/os-base_arm.tar.xz +ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2016.05-1/os-base_amd64.tar.xz +ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2016.05-1/os-base_arm64.tar.xz +ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.05-1/os-base_arm.tar.xz ###################################################### -# Set up environment -ENV GOARCH $ARCH +# Set up environment and export all ARGS as ENV +ENV ARCH ${ARCH} +ENV BUILD_DOCKER_URL BUILD_DOCKER_URL_${ARCH} +ENV BUILD_DOCKER_URL_amd64 ${BUILD_DOCKER_URL_amd64} +ENV BUILD_DOCKER_URL_arm ${BUILD_DOCKER_URL_arm} +ENV BUILD_DOCKER_URL_arm64 ${BUILD_DOCKER_URL_arm64} +ENV DAPPER_HOST_ARCH ${DAPPER_HOST_ARCH} +ENV DFS_IMAGE ${DFS_IMAGE} +ENV DISTRIB_ID ${DISTRIB_ID} +ENV DOCKER_PATCH_VERSION ${DOCKER_PATCH_VERSION} ENV DOCKER_URL DOCKER_URL_${ARCH} -ENV KERNEL_URL KERNEL_URL_${ARCH} -ENV OS_BASE_URL OS_BASE_URL_${ARCH} -ENV OS_BASE_SHA1 OS_BASE_SHA1_${ARCH} -ENV VBOX_MODULES_URL VBOX_MODULES_URL_${ARCH} -ENV REPO_VERSION master - -# Export all ARGS as ENV -ENV ARCH=${ARCH} DAPPER_HOST_ARCH=${DAPPER_HOST_ARCH} HOST_ARCH=${HOST_ARCH} OS_REPO=${OS_REPO} HOSTNAME_DEFAULT=${HOSTNAME_DEFAULT} DISTRIB_ID=${DISTRIB_ID} DOCKER_VERSION=${DOCKER_VERSION} DOCKER_PATCH_VERSION=${DOCKER_PATCH_VERSION} SELINUX_POLICY_URL=${SELINUX_POLICY_URL} KERNEL_URL_amd64=${KERNEL_URL_amd64} KERNEL_URL_arm64=${KERNEL_URL_arm64} DOCKER_URL_amd64=${DOCKER_URL_amd64} DOCKER_URL_arm=${DOCKER_URL_arm} DOCKER_URL_arm64=${DOCKER_URL_arm64} TOOLCHAIN_arm64=${TOOLCHAIN_arm64} TOOLCHAIN_arm=${TOOLCHAIN_arm} OS_RELEASES_YML=${OS_RELEASES_YML} VBOX_MODULES_URL=${VBOX_MODULES_URL} VBOX_MODULES_URL_amd64=${VBOX_MODULES_URL_amd64} OS_SERVICES_REPO=${OS_SERVICES_REPO} IMAGE_NAME=${IMAGE_NAME} DFS_IMAGE=${DFS_IMAGE} OS_BASE_URL=${OS_BASE_URL} OS_BASE_SHA1=${OS_BASE_SHA1} OS_BASE_URL_amd64=${OS_BASE_URL_amd64} OS_BASE_URL_arm=${OS_BASE_URL_arm} OS_BASE_URL_arm64=${OS_BASE_URL_arm64} - +ENV DOCKER_URL_amd64 ${DOCKER_URL_amd64} +ENV DOCKER_URL_arm ${DOCKER_URL_arm} +ENV DOCKER_URL_arm64 ${DOCKER_URL_arm64} +ENV DOCKER_VERSION ${DOCKER_VERSION} ENV DOWNLOADS /usr/src/downloads +ENV GOARCH $ARCH +ENV HOSTNAME_DEFAULT ${HOSTNAME_DEFAULT} +ENV HOST_ARCH ${HOST_ARCH} +ENV IMAGE_NAME ${IMAGE_NAME} +ENV KERNEL_URL KERNEL_URL_${ARCH} +ENV KERNEL_URL_amd64 ${KERNEL_URL_amd64} +ENV KERNEL_URL_arm64 ${KERNEL_URL_arm64} +ENV OS_BASE_SHA1 OS_BASE_SHA1_${ARCH} +ENV OS_BASE_URL OS_BASE_URL_${ARCH} +ENV OS_BASE_URL_amd64 ${OS_BASE_URL_amd64} +ENV OS_BASE_URL_arm ${OS_BASE_URL_arm} +ENV OS_BASE_URL_arm64 ${OS_BASE_URL_arm64} +ENV OS_RELEASES_YML ${OS_RELEASES_YML} +ENV OS_REPO ${OS_REPO} +ENV OS_SERVICES_REPO ${OS_SERVICES_REPO} +ENV REPO_VERSION master +ENV SELINUX_POLICY_URL ${SELINUX_POLICY_URL} +ENV TOOLCHAIN_arm ${TOOLCHAIN_arm} +ENV TOOLCHAIN_arm64 ${TOOLCHAIN_arm64} +ENV VBOX_MODULES_URL ${VBOX_MODULES_URL} +ENV VBOX_MODULES_URL VBOX_MODULES_URL_${ARCH} +ENV VBOX_MODULES_URL_amd64 ${VBOX_MODULES_URL_amd64} + RUN mkdir -p ${DOWNLOADS} # Download kernel @@ -116,8 +148,7 @@ ENV GOPATH /go ENV PATH ${GOPATH}/bin:/usr/local/go/bin:$PATH # Install Host Docker -RUN URL=DOCKER_URL_${HOST_ARCH} && \ - curl -fL ${!URL} | tar xzf - --strip-components=1 -C /usr/bin docker/docker && \ +RUN curl -fL ${!BUILD_DOCKER_URL} > /usr/bin/docker && \ chmod +x /usr/bin/docker # Install Target Docker @@ -127,7 +158,7 @@ RUN curl -fL ${!DOCKER_URL} > ${DOWNLOADS}/docker.tgz RUN go get github.com/rancher/trash # Install dapper -RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > /usr/bin/dapper && \ +RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m | sed 's/arm.*/arm/'` > /usr/bin/dapper && \ chmod +x /usr/bin/dapper # Install toolchain @@ -177,7 +208,6 @@ RUN source /usr/src/toolchain-env; if [ "${TOOLCHAIN}" != "" ]; then \ make install \ ;fi - RUN mkdir -p images/00-rootfs/build && \ curl -pfL ${!OS_BASE_URL} | tar xvJf - -C images/00-rootfs/build diff --git a/images/01-base/Dockerfile b/images/01-base/Dockerfile index 896c727c..a6f2925d 100644 --- a/images/01-base/Dockerfile +++ b/images/01-base/Dockerfile @@ -27,8 +27,9 @@ RUN rm /sbin/poweroff /sbin/reboot /sbin/halt && \ addgroup -g 1103 sudo && \ adduser -u 1100 -G rancher -D -h /home/rancher -s /bin/bash rancher && \ adduser -u 1101 -G docker -D -h /home/docker -s /bin/bash docker && \ - sed -i 's/\(^docker.*\)/\1rancher/g' /etc/group && \ - sed -i 's/\(^sudo.*\)/\1rancher,docker/g' /etc/group && \ + adduser rancher docker && \ + adduser rancher sudo && \ + adduser docker sudo && \ echo '%sudo ALL=(ALL) ALL' >> /etc/sudoers COPY inputrc /etc/inputrc COPY entry.sh /usr/sbin/entry.sh diff --git a/images/02-console/console.sh b/images/02-console/console.sh index 980a9efe..5550eaf6 100755 --- a/images/02-console/console.sh +++ b/images/02-console/console.sh @@ -143,4 +143,5 @@ if [ -x /etc/rc.local ]; then /etc/rc.local || true fi +export TERM=linux exec respawn -f /etc/respawn.conf diff --git a/images/02-extras/Dockerfile b/images/02-extras/Dockerfile deleted file mode 100644 index e8ed9627..00000000 --- a/images/02-extras/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM rancher/os-base -COPY extra.sh / -CMD ["/extra.sh"] diff --git a/images/02-extras/extra.sh b/images/02-extras/extra.sh deleted file mode 100755 index 3acdd6ae..00000000 --- a/images/02-extras/extra.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -DIR=$(readlink /lib/modules/$(uname -r)/build) -STAMP=/lib/modules/$(uname -r)/.extra-done -VER=$(basename $DIR) -URL=https://github.com/rancher/os-kernel/releases/download/${VER}/extra.tar.gz - -if [ -e $STAMP ]; then - echo Kernel extras already installed in $DIR - exit 0 -fi - -echo Downloading $URL -wget -O - $URL | gzip -dc | tar xf - -C / -touch $STAMP - -echo Kernel extras installed at $DIR diff --git a/images/02-headers/Dockerfile b/images/02-headers/Dockerfile deleted file mode 100644 index be9712a7..00000000 --- a/images/02-headers/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM rancher/os-base -COPY headers.sh / -CMD ["/headers.sh"] diff --git a/images/02-headers/headers.sh b/images/02-headers/headers.sh deleted file mode 100755 index 63a12709..00000000 --- a/images/02-headers/headers.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -set -e - -DIR=$(readlink /lib/modules/$(uname -r)/build) -STAMP=${DIR}/.done -VER=$(basename $DIR) -URL=https://github.com/rancher/os-kernel/releases/download/${VER}/build.tar.gz - -if [ -e $STAMP ]; then - echo Headers already installed in $DIR - exit 0 -fi - -echo Downloading $URL -mkdir -p $DIR -wget -O - $URL | gzip -dc | tar xf - -C $DIR -touch $STAMP - -echo Headers installed at $DIR diff --git a/images/03-rescue/Dockerfile b/images/03-rescue/Dockerfile deleted file mode 100644 index 6724d6c3..00000000 --- a/images/03-rescue/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM rancher/os-console -CMD ["/bin/sh"] diff --git a/images/10-centosconsole/Dockerfile b/images/10-centosconsole/Dockerfile deleted file mode 100644 index b224279f..00000000 --- a/images/10-centosconsole/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM rancher/os-centosconsole-base -# FROM amd64=centos:7 arm64=skip arm=armhfbuild/centos:7 -RUN yum upgrade -y && \ - yum install -y iptables openssh-server rsync sudo vim less ca-certificates psmisc htop procps-ng -RUN rm -rf /etc/ssh/*key* -RUN rm -fr /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt -RUN ln -s /sbin/agetty /sbin/getty -COPY build/entry.sh build/console.sh build/docker-init build/update-ssh-keys build/rancheros-install /usr/sbin/ -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN groupadd --gid 1100 rancher && \ - groupadd --gid 1101 docker && \ - useradd -u 1100 -g rancher -G docker,wheel -m -s /bin/bash rancher && \ - useradd -u 1101 -g docker -G docker,wheel -m -s /bin/bash docker && \ - echo ClientAliveInterval 180 >> /etc/ssh/sshd_config && \ - echo '## allow password less for rancher user' >> /etc/sudoers && \ - echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - echo '## allow password less for docker user' >> /etc/sudoers && \ - echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - ln -sf /usr/bin/docker.dist /usr/bin/docker && \ - ln -sf /usr/bin/docker-containerd.dist /usr/bin/docker-containerd && \ - ln -sf /usr/bin/docker-containerd-shim.dist /usr/bin/docker-containerd-shim && \ - ln -sf /usr/bin/docker-runc.dist /usr/bin/docker-runc -COPY prompt.sh /etc/profile.d/ -ENTRYPOINT ["/usr/sbin/entry.sh"] -CMD ["/usr/sbin/console.sh"] diff --git a/images/10-centosconsole/prebuild.sh b/images/10-centosconsole/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/10-centosconsole/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/images/10-centosconsole/prompt.sh b/images/10-centosconsole/prompt.sh deleted file mode 100644 index 4438c010..00000000 --- a/images/10-centosconsole/prompt.sh +++ /dev/null @@ -1 +0,0 @@ -export PS1='[\u@\h \W]\$ ' diff --git a/images/10-debianconsole/Dockerfile b/images/10-debianconsole/Dockerfile deleted file mode 100644 index 43324a3d..00000000 --- a/images/10-debianconsole/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM rancher/os-debianconsole-base -# FROM amd64=debian:jessie arm64=aarch64/debian:jessie arm=resin/rpi-raspbian:jessie -RUN apt-get update && \ - apt-get upgrade --no-install-recommends -y && \ - apt-get install -y --no-install-recommends iptables openssh-server rsync locales sudo vim less curl ca-certificates psmisc htop -RUN rm -rf /etc/ssh/*key* -RUN rm -fr /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt -COPY build/entry.sh build/console.sh build/docker-init build/update-ssh-keys build/rancheros-install /usr/sbin/ -RUN locale-gen en_US.UTF-8 -RUN addgroup --gid 1100 rancher && \ - addgroup --gid 1101 docker && \ - useradd -u 1100 -g rancher -G docker,sudo -m -s /bin/bash rancher && \ - useradd -u 1101 -g docker -G docker,sudo -m -s /bin/bash docker && \ - echo ClientAliveInterval 180 >> /etc/ssh/sshd_config && \ - echo '## allow password less for rancher user' >> /etc/sudoers && \ - echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - echo '## allow password less for docker user' >> /etc/sudoers && \ - echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - ln -sf /usr/bin/docker.dist /usr/bin/docker && \ - ln -sf /usr/bin/docker-containerd.dist /usr/bin/docker-containerd && \ - ln -sf /usr/bin/docker-containerd-shim.dist /usr/bin/docker-containerd-shim && \ - ln -sf /usr/bin/docker-runc.dist /usr/bin/docker-runc -ENTRYPOINT ["/usr/sbin/entry.sh"] -CMD ["/usr/sbin/console.sh"] diff --git a/images/10-debianconsole/prebuild.sh b/images/10-debianconsole/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/10-debianconsole/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/images/10-fedoraconsole/Dockerfile b/images/10-fedoraconsole/Dockerfile deleted file mode 100644 index a67c93b6..00000000 --- a/images/10-fedoraconsole/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM rancher/os-fedoraconsole-base -# FROM amd64=fedora:23 arm64=rancher/aarch64-fedora:23 arm=armv7/armhf-fedora:23 -RUN dnf upgrade -y && \ - dnf install -y iptables openssh-server rsync sudo vim less ca-certificates psmisc htop procps-ng -RUN rm -rf /etc/ssh/*key* -RUN rm -fr /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt -RUN ln -s /sbin/agetty /sbin/getty -COPY build/entry.sh build/console.sh build/docker-init build/update-ssh-keys build/rancheros-install /usr/sbin/ -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN groupadd --gid 1100 rancher && \ - groupadd --gid 1101 docker && \ - useradd -u 1100 -g rancher -G docker,wheel -m -s /bin/bash rancher && \ - useradd -u 1101 -g docker -G docker,wheel -m -s /bin/bash docker && \ - echo ClientAliveInterval 180 >> /etc/ssh/sshd_config && \ - echo '## allow password less for rancher user' >> /etc/sudoers && \ - echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - echo '## allow password less for docker user' >> /etc/sudoers && \ - echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - ln -sf /usr/bin/docker.dist /usr/bin/docker && \ - ln -sf /usr/bin/docker-containerd.dist /usr/bin/docker-containerd && \ - ln -sf /usr/bin/docker-containerd-shim.dist /usr/bin/docker-containerd-shim && \ - ln -sf /usr/bin/docker-runc.dist /usr/bin/docker-runc -COPY prompt.sh /etc/profile.d/ -ENTRYPOINT ["/usr/sbin/entry.sh"] -CMD ["/usr/sbin/console.sh"] diff --git a/images/10-fedoraconsole/prebuild.sh b/images/10-fedoraconsole/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/10-fedoraconsole/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/images/10-fedoraconsole/prompt.sh b/images/10-fedoraconsole/prompt.sh deleted file mode 100644 index 4438c010..00000000 --- a/images/10-fedoraconsole/prompt.sh +++ /dev/null @@ -1 +0,0 @@ -export PS1='[\u@\h \W]\$ ' diff --git a/images/10-resizefs/Dockerfile b/images/10-resizefs/Dockerfile deleted file mode 100644 index 8b15f8a0..00000000 --- a/images/10-resizefs/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM rancher/os-resizefs-base -# FROM amd64=ubuntu:16.04 arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04 -RUN apt-get update && \ - apt-get install -y --no-install-recommends cloud-guest-utils parted && \ - apt-get clean && rm -rf /var/lib/apt/lists/* -COPY resizefs.sh / -ENTRYPOINT ["/resizefs.sh"] diff --git a/images/10-resizefs/resizefs.sh b/images/10-resizefs/resizefs.sh deleted file mode 100755 index a1d46c91..00000000 --- a/images/10-resizefs/resizefs.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -ex - -RESIZE_DEV=${RESIZE_DEV:?"RESIZE_DEV not set."} -STAMP=/var/log/resizefs.done - -if [ -e "${STAMP}" ]; then - echo FS already resized. - exit 0 -fi - -# TODO: rm hardcoded partition number, maybe identify RANCHER_STATE partition (can be the whole device) -if [ -b "${RESIZE_DEV}" ]; then - growpart ${RESIZE_DEV} 1 || : # ignore error "NOCHANGE: partition 1 is size NNN. it cannot be grown" - partprobe ${RESIZE_DEV} - resize2fs ${RESIZE_DEV}1 -else - echo "Block device expected: ${RESIZE_DEV} is not." - exit 1 -fi - -touch $STAMP diff --git a/images/10-selinuxtools/Dockerfile b/images/10-selinuxtools/Dockerfile deleted file mode 100644 index b8dbfd0f..00000000 --- a/images/10-selinuxtools/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM rancher/os-fedoraconsole-base -# FROM amd64=fedora:23 arm64=rancher/aarch64-fedora:23 arm=armv7/armhf-fedora:23 -RUN dnf upgrade -y && \ - dnf install -y iptables openssh-server rsync sudo vim less ca-certificates psmisc htop procps-ng -RUN rm -rf /etc/ssh/*key* -RUN rm -fr /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt -RUN ln -s /sbin/agetty /sbin/getty -COPY build/entry.sh build/console.sh build/docker-init build/update-ssh-keys build/rancheros-install /usr/sbin/ -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN groupadd --gid 1100 rancher && \ - groupadd --gid 1101 docker && \ - useradd -u 1100 -g rancher -G docker,wheel -m -s /bin/bash rancher && \ - useradd -u 1101 -g docker -G docker,wheel -m -s /bin/bash docker && \ - echo ClientAliveInterval 180 >> /etc/ssh/sshd_config && \ - echo '## allow password less for rancher user' >> /etc/sudoers && \ - echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - echo '## allow password less for docker user' >> /etc/sudoers && \ - echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - ln -sf /usr/bin/docker.dist /usr/bin/docker -COPY prompt.sh /etc/profile.d/ - -RUN dnf install -y git make gcc findutils selinux-policy-devel setools-console setools-devel - -RUN git clone https://github.com/rancher/refpolicy.git /usr/src/refpolicy -RUN cd /usr/src/refpolicy && git submodule init && git submodule update && \ - sed -i '/MONOLITHIC = y/c\MONOLITHIC = n' build.conf && \ - make conf && make && make install-headers - -ENTRYPOINT ["/usr/sbin/entry.sh"] diff --git a/images/10-selinuxtools/prebuild.sh b/images/10-selinuxtools/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/10-selinuxtools/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/images/10-selinuxtools/prompt.sh b/images/10-selinuxtools/prompt.sh deleted file mode 100644 index 4438c010..00000000 --- a/images/10-selinuxtools/prompt.sh +++ /dev/null @@ -1 +0,0 @@ -export PS1='[\u@\h \W]\$ ' diff --git a/images/10-ubuntuconsole/Dockerfile b/images/10-ubuntuconsole/Dockerfile deleted file mode 100644 index 26472664..00000000 --- a/images/10-ubuntuconsole/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM rancher/os-ubuntuconsole-base -# FROM amd64=ubuntu:16.04 arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04 -RUN apt-get update && \ - apt-get upgrade --no-install-recommends -y && \ - apt-get install -y --no-install-recommends iptables openssh-server rsync vim curl ca-certificates psmisc htop -RUN rm -rf /etc/ssh/*key* -RUN rm -fr /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt -COPY build/entry.sh build/console.sh build/docker-init build/update-ssh-keys build/rancheros-install /usr/sbin/ -RUN locale-gen en_US.UTF-8 -RUN addgroup --gid 1100 rancher && \ - addgroup --gid 1101 docker && \ - useradd -u 1100 -g rancher -G docker,sudo -m -s /bin/bash rancher && \ - useradd -u 1101 -g docker -G docker,sudo -m -s /bin/bash docker && \ - echo ClientAliveInterval 180 >> /etc/ssh/sshd_config && \ - echo '## allow password less for rancher user' >> /etc/sudoers && \ - echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - echo '## allow password less for docker user' >> /etc/sudoers && \ - echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ - ln -sf /usr/bin/docker.dist /usr/bin/docker && \ - ln -sf /usr/bin/docker-containerd.dist /usr/bin/docker-containerd && \ - ln -sf /usr/bin/docker-containerd-shim.dist /usr/bin/docker-containerd-shim && \ - ln -sf /usr/bin/docker-runc.dist /usr/bin/docker-runc -ENTRYPOINT ["/usr/sbin/entry.sh"] -CMD ["/usr/sbin/console.sh"] diff --git a/images/10-ubuntuconsole/prebuild.sh b/images/10-ubuntuconsole/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/10-ubuntuconsole/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/images/20-desktop/Dockerfile b/images/20-desktop/Dockerfile deleted file mode 100644 index e7ca331e..00000000 --- a/images/20-desktop/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM rancher/os-ubuntuconsole -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y xfce4 slim diff --git a/images/20-desktop/prebuild.sh b/images/20-desktop/prebuild.sh deleted file mode 100755 index d4c8cdb0..00000000 --- a/images/20-desktop/prebuild.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -rm -rf ./build -mkdir -p ./build -cp ./../01-base/entry.sh ./build/ -cp ./../02-console/console.sh ./build/ -cp ./../02-console/docker-init ./build/ -cp ./../02-console/update-ssh-keys ./build/ -cp ./../02-console/rancheros-install ./build/ diff --git a/scripts/build-images b/scripts/build-images index 39ea0774..26a87c8a 100755 --- a/scripts/build-images +++ b/scripts/build-images @@ -7,36 +7,19 @@ BASE=images source $(dirname $0)/version cd $(dirname $0)/.. -DO_PUSH="$1" +for i in $BASE/[0-9]*; do + name="os-$(echo ${i} | cut -f2 -d-)" + tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}" + echo Building ${tag} + if [ -x ${i}/prebuild.sh ]; then + ${i}/prebuild.sh + fi -if [ -n "$CORE" ]; then - PREFIX=0 -fi - -if [ "${DO_PUSH}" == "--push" ]; then - for i in $BASE/[0-9]*; do - name="os-$(echo ${i} | cut -f2 -d-)" - tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}" - echo Pushing ${tag} - docker push ${tag} || : - done -else - for i in $BASE/$PREFIX[0-9]*; do - name="os-$(echo ${i} | cut -f2 -d-)" - tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}" - echo Building ${tag} - if [ -x ${i}/prebuild.sh ]; then - if ${i}/prebuild.sh; then - dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i} - docker tag rancher/${name} ${tag} - elif [ "$?" != "42" ]; then - exit 1 - else - echo "WARN: Skipping ${tag}" - fi - else - dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i} - docker tag rancher/${name} ${tag} - fi - done -fi + if dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i}; then + docker tag rancher/${name} ${tag} + elif [ "$?" != "42" ]; then + exit 1 + else + echo "WARN: Skipping ${tag}" + fi +done diff --git a/scripts/prepare b/scripts/prepare index a4cbb7c1..a05c292b 100755 --- a/scripts/prepare +++ b/scripts/prepare @@ -10,8 +10,6 @@ if [ ! -e ../bin/host_ros ]; then fi ./template -if [ "$HOST_ARCH" = "$ARCH" ]; then - CORE=true ./build-images -fi +./build-images ./tar-images ./layout