aboutsummaryrefslogtreecommitdiffstats
path: root/build/docker
diff options
context:
space:
mode:
Diffstat (limited to 'build/docker')
-rw-r--r--build/docker/.gitignore2
-rw-r--r--build/docker/Dockerfile46
-rw-r--r--build/docker/Makefile103
-rw-r--r--build/docker/README25
-rwxr-xr-xbuild/docker/runcontext132
-rwxr-xr-xbuild/docker/ubuntu-builder/install_docker.sh36
-rwxr-xr-xbuild/docker/ubuntu-builder/setcontext20
7 files changed, 0 insertions, 364 deletions
diff --git a/build/docker/.gitignore b/build/docker/.gitignore
deleted file mode 100644
index 2585910ce..000000000
--- a/build/docker/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.docker*
-ubuntu-builder/Dockerfile
diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
deleted file mode 100644
index ce0c595d4..000000000
--- a/build/docker/Dockerfile
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-FROM ubuntu:14.04
-ENV http_proxy INSERT_HTTP_PROXY
-ENV https_proxy INSERT_HTTPS_PROXY
-ENV no_proxy INSERT_NO_PROXY
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN apt-get update
-RUN apt-get install -y software-properties-common python-software-properties \
- make python-setuptools python-all dpkg-dev debhelper ruby-json \
- fuseiso git genisoimage bind9-host wget curl lintian tmux lxc iptables \
- ca-certificates sudo apt-utils lsb-release dosfstools debmirror p7zip-full \
- build-essential ruby-dev rubygems-integration python-pip git rpm createrepo dpkg-dev \
- syslinux
-
-RUN gem install fpm
-RUN pip install git+https://github.com/openstack/fuel-plugins
-# fuel-infra key
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BCE5CC461FA22B08
-
-RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo
-RUN echo "Defaults env_keep += \"ftp_proxy http_proxy https_proxy no_proxy RSYNC_PROXY RSYNC_CONNECT_PROG npm_config_registry\"" > /etc/sudoers.d/keep-proxies
-# Keeping PWD is needed to build as root
-RUN echo "Defaults env_keep += \"PWD\"" > /etc/sudoers.d/keep-pwd
-# Keeping variables for ISO build
-RUN echo "Defaults env_keep += \"MIRROR_UBUNTU MIRROR_UBUNTU_ROOT MIRROR_MOS_UBUNTU MIRROR_MOS_UBUNTU_ROOT MIRROR_FUEL LATEST_TARGET_UBUNTU UBUNTU_ARCH\"" > /etc/sudoers.d/keep-mos
-RUN chmod 0440 /etc/sudoers.d/open-sudo
-RUN chmod 0440 /etc/sudoers.d/keep-proxies
-RUN chmod 0440 /etc/sudoers.d/keep-pwd
-RUN chmod 0440 /etc/sudoers.d/keep-mos
-RUN chmod 4755 /bin/fusermount
-
-ADD ./setcontext /root/setcontext
-RUN chmod +x /root/setcontext
-
-VOLUME /var/lib/docker
diff --git a/build/docker/Makefile b/build/docker/Makefile
deleted file mode 100644
index cdf4a359c..000000000
--- a/build/docker/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
-##############################################################################
-# Copyright (c) 2015,2016 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-SHELL = /bin/bash
-FILES = $(wildcard ubuntu-builder/*) runcontext
-DOCKER_VER := $(shell [[ "$$(docker version --format '{{.Client.Version}}')" =~ ([0-9]+)\.([0-9]+) ]] && echo $$(( $${BASH_REMATCH[1]} * 100 + $${BASH_REMATCH[2]} )))
-
-# Builder tag lifespan, force container rebuild X days after tag creation
-DOCKER_KEEP = 1 days
-DOCKER_IMG = opnfv.org/ubuntu-builder
-DOCKER_TAG = ${DOCKER_IMG}:14.04
-# Shell contruct for checking our tag object did not expire
-DOCKER_EXPIRED = D_TAG_BIRTH=`docker inspect --format="{{.Created}}" \
- ${DOCKER_TAG} 2>/dev/null`; test -z "$$D_TAG_BIRTH" -o `date +%s` -gt \
- `date -d "$$D_TAG_BIRTH +${DOCKER_KEEP}" +%s`; echo $$?
-
-# Don't use -f flag when docker is newer than 1.9
-# https://docs.docker.com/engine/deprecated/#/f-flag-on-docker-tag
-ifeq ($(shell echo "$(DOCKER_VER)>109" | bc), 1)
- tag_flags :=
-else
- tag_flags := -f
-endif
-
-.PHONY: all
-all: .docker
-
-.dockercfg: $(FILES)
- cp Dockerfile ubuntu-builder/Dockerfile
- # Only add proxy ENVs where set in host - needed to pull the base Ubuntu image
- test -n "${http_proxy}" && sed -i "s;INSERT_HTTP_PROXY;${http_proxy};" ubuntu-builder/Dockerfile || exit 0
- test -n "${https_proxy}" && sed -i "s;INSERT_HTTPS_PROXY;${https_proxy};" ubuntu-builder/Dockerfile || exit 0
- test -n "${no_proxy}" && sed -i "s;INSERT_NO_PROXY;${no_proxy};" ubuntu-builder/Dockerfile || exit 0
- test -n "${HTTP_PROXY}" && sed -i "s;INSERT_HTTP_PROXY;${HTTP_PROXY};" ubuntu-builder/Dockerfile || exit 0
- test -n "${HTTPS_PROXY}" && sed -i "s;INSERT_HTTPS_PROXY;${HTTPS_PROXY};" ubuntu-builder/Dockerfile || exit 0
- test -n "${NO_PROXY}" && sed -i "s;INSERT_NO_PROXY;${NO_PROXY};" ubuntu-builder/Dockerfile || exit 0
- sed -i '/INSERT_/d' ubuntu-builder/Dockerfile
- touch $@
-
-.docker: .dockercfg
- @if test -f .cacheid -o "$(shell ${DOCKER_EXPIRED})" -eq "0"; then \
- /usr/bin/docker build --rm=true --no-cache=true \
- -t ${DOCKER_TAG} ubuntu-builder && \
- /usr/bin/docker tag ${tag_flags} ${DOCKER_TAG} ${DOCKER_IMG}; \
- else \
- echo "Docker: Tag '${DOCKER_TAG}' was created less than" \
- "${DOCKER_KEEP} ago, skipping re-build."; \
- fi
- touch $@
- test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0
-
-.PHONY: clean
-clean:
- rm -f .docker* ubuntu-builder/Dockerfile
-
-.PHONY: deepclean
-deepclean: clean clean-cache
-
-##############################################################################
-# Cache operations - only used when building through ci/build.sh
-##############################################################################
-
-# NOTE: For docker, we only get/put cache to fingerprint build scripts and
-# env vars, its cached data holds only an empty .docker file.
-
-# Create a unique hash to be used for getting and putting cache, based on:
-# - ubuntu-builder Dockerfile (includes eventual proxy env vars), runcontext;
-# - The contents of this Makefile
-.cacheid: .dockercfg
- sha1sum Makefile runcontext ubuntu-builder/* > .cachedata
- cat .cachedata | $(CACHETOOL) getid > .cacheid
-
-# Clean local data related to caching - called prior to ordinary build
-.PHONY: clean-cache
-clean-cache:
- rm -f .cachedata .cacheid
-
-# Try to download cache - called prior to ordinary build
-.PHONY: get-cache
-get-cache: .cacheid
- @if $(CACHETOOL) check $(shell cat .cacheid); then \
- if test "$(shell ${DOCKER_EXPIRED})" -eq "0"; then \
- echo "Docker: Tag '${DOCKER_TAG}' missing" \
- "or older than ${DOCKER_KEEP}, not using it."; \
- else \
- touch .docker; \
- fi; \
- else \
- echo "No cache item found for $(shell cat .cacheid)" ;\
- exit 0;\
- fi
-
-# Store cache if not already stored - called after ordinary build
-.PHONY: put-cache
-put-cache: .cacheid
- @tar cf - .docker | $(CACHETOOL) put $(shell cat .cacheid)
diff --git a/build/docker/README b/build/docker/README
deleted file mode 100644
index e5ccdfab6..000000000
--- a/build/docker/README
+++ /dev/null
@@ -1,25 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-The makefile on this level is used for *creating* the Docker image
-used for building in Ubuntu 12.04 context.
-
-There are two requirements before running make on this level:
-
-1. You need to have Docker installed on your system
-
-2. If in a corporate network, make sure to have a valid DNS config in
- your /etc/default/docker, e.g:
-
- DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4"
-
-The top level makefile will refer to the "runcontext" file in order to
-run the build process as the current user with the current working
-directory available to the container.
diff --git a/build/docker/runcontext b/build/docker/runcontext
deleted file mode 100755
index b17571135..000000000
--- a/build/docker/runcontext
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/bin/bash
-set -e
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-#
-
-############################################################################
-# BEGIN of Exit handlers
-#
-
-do_exit () {
- CID=`cat $CID_FILE </dev/null`
- rm -f $CID_FILE
- rm -rf $CONTEXT_DIR
- set +e
- docker kill $CID > /dev/null 2>&1
- docker rm -f $CID > /dev/null 2>&1
- docker rmi -f $IID > /dev/null 2>&1
- set -e
-}
-
-#
-# End of Exit handlers
-############################################################################
-
-trap do_exit SIGINT SIGTERM EXIT
-
-context=$1
-shift
-USER_ID=`id -u`
-USER=`whoami`
-GROUP_ID=`id -g`
-
-GITROOT=`git rev-parse --show-toplevel`
-CID_FILE=`mktemp -u -t runcontext.XXXXXXXXXX`
-CONTEXT_DIR=`mktemp -d ${GITROOT}/.docker_contextXXXXXX`
-
-# If RSYNC_CONNECT_PROG is used, we need to copy all of
-# the SSH structure, should one of the keys need to be
-# used.
-if [ -n "$RSYNC_CONNECT_PROG" -a -x $HOME/.ssh ]; then
- cp -rp $HOME/.ssh $CONTEXT_DIR
- rm -f $CONTEXT_DIR/.ssh/known_hosts
-else
- mkdir $CONTEXT_DIR/.ssh
-fi
-
-# Disable verification of unknown keys
-cat >> $CONTEXT_DIR/.ssh/config <<EOF
-StrictHostKeyChecking=no
-EOF
-
-cat > $CONTEXT_DIR/Dockerfile <<EOF
-FROM $context
-$(env | egrep -i 'proxy|rsync' | sed 's/^/ENV /' | sed 's/=/ /')
-RUN date || date
-COPY .ssh $HOME/.ssh
-RUN chown -R $USER_ID:$GROUP_ID $HOME/.ssh
-RUN chown -R $USER_ID:$GROUP_ID $HOME
-RUN chmod 700 $HOME/.ssh
-RUN /root/setcontext $USER $USER_ID $GROUP_ID $HOME
-EOF
-
-res=`docker build -q --force-rm $CONTEXT_DIR`
-IID=`echo $res | sed 's/.* //'`
-
-# Handle proxy settings passed to the context
-if env | grep -iq .*proxy; then
- envfile="$(readlink -f $(dirname $0)/..)/environment.mk"
-
- test -n "$HTTP_PROXY" && my_http_proxy=$HTTP_PROXY
- test -n "$http_proxy" && my_http_proxy=$http_proxy
-
- test -n "$HTTPS_PROXY" && my_https_proxy=$HTTPS_PROXY
- test -n "$https_proxy" && my_https_proxy=$https_proxy
-
- test -n "$NO_PROXY" && my_no_proxy=$NO_PROXY
- test -n "$no_proxy" && my_no_proxy=$no_proxy
-
- # Make sure to add the Docker socket in no_proxy
- if [ -n "$my_no_proxy" ]; then
- my_no_proxy+=",/var/run/docker.sock"
- else
- my_no_proxy="/var/run/docker.sock"
- fi
-
- echo "Creating $envfile"
- echo "# This file is automatically generated by runcontext, do not edit!" > $envfile
- test -n "$my_http_proxy" && echo "export http_proxy=$my_http_proxy" >> $envfile
- test -n "$my_https_proxy" && echo "export https_proxy=$my_https_proxy" >> $envfile
- test -n "$my_no_proxy" && echo "export no_proxy=$my_no_proxy" >> $envfile
- test -n "$RSYNC_PROXY" && echo "export RSYNC_PROXY=$RSYNC_PROXY" >> $envfile
- test -n "$RSYNC_CONNECT_PROG" && echo "export RSYNC_CONNECT_PROG=$RSYNC_CONNECT_PROG" >> $envfile
- echo "export npm_config_registry=http://registry.npmjs.org/" >> $envfile
-else
- echo "No need to generate environment.mk"
- rm -f $envfile
-fi
-
-# Evaluate the need for bind mounting the cache directory
-if [ -n "$CACHEBASE" ]; then
- if echo $CACHEBASE | grep -q '^file://'; then
- CACHEMOUNT="-v $(echo $CACHEBASE | sed 's;file://;;'):$(echo $CACHEBASE | sed 's;file://;;')"
- fi
-fi
-
-# FIXME: TERM is required because: https://github.com/docker/docker/issues/9299
-RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm \
- -e TERM=$TERM \
- -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE \
- -e BUILD_FUEL_PLUGINS -e MIRROR_UBUNTU -e MIRROR_UBUNTU_ROOT \
- -e MIRROR_MOS_UBUNTU -e MIRROR_MOS_UBUNTU_ROOT -e MIRROR_FUEL \
- -e LATEST_TARGET_UBUNTU -e UBUNTU_ARCH -e OPNFV_GIT_SHA \
- -u $USER_ID:$GROUP_ID -w $PWD \
- -v $GITROOT:$GITROOT -v /sys/fs/cgroup:/sys/fs/cgroup:ro $CACHEMOUNT"
-
-# Passing "debug" puts up an interactive bash shell
-if [ "$1" == "debug" ]; then
- echo command: docker run ${RUN_CONTEXT_OPT} $IID bash
- docker run -i -t ${RUN_CONTEXT_OPT} $IID bash
-else
- echo command: docker run ${RUN_CONTEXT_OPT} $IID $@
- docker run -t ${RUN_CONTEXT_OPT} $IID $@
-fi
-
diff --git a/build/docker/ubuntu-builder/install_docker.sh b/build/docker/ubuntu-builder/install_docker.sh
deleted file mode 100755
index 47c3a52ec..000000000
--- a/build/docker/ubuntu-builder/install_docker.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# From prepare-build-env.sh of Fuel
-# Check if docker is installed
-if hash docker 2>/dev/null; then
- echo "Docker binary found, checking if service is running..."
- ps cax | grep docker > /dev/null
- if [ $? -eq 0 ]; then
- echo "Docker is running."
- else
- echo "Process is not running, starting it..."
- sudo service docker start
- fi
-else
- # Install docker repository
- # Check that HTTPS transport is available to APT
- if [ ! -e /usr/lib/apt/methods/https ]; then
- sudo apt-get update
- sudo apt-get -y install -y apt-transport-https
- fi
- # Add the repository to APT sources
- echo deb http://mirror.yandex.ru/mirrors/docker/ docker main | sudo tee /etc/apt/sources.list.d/docker.list
- # Import the repository key
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
- # Install docker
- sudo apt-get update
- sudo apt-get -y install lxc-docker-1.7.1
-fi
diff --git a/build/docker/ubuntu-builder/setcontext b/build/docker/ubuntu-builder/setcontext
deleted file mode 100755
index bc28994a9..000000000
--- a/build/docker/ubuntu-builder/setcontext
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-#
-SETUSER=$1
-SETUID=$2
-SETGID=$3
-SETHOME=$4
-
-getent group $SETUSER || /usr/sbin/groupadd --gid $SETGID $SETUSER
-getent passwd $SETUSER || /usr/sbin/adduser --system --uid=$SETUID --gid=$SETGID --home $SETHOME --shell /bin/bash $SETUSER
-/usr/sbin/usermod -a -G fuse $SETUSER
-exit 0