Skip to content

Commit

Permalink
Update docker_build.sh (#13)
Browse files Browse the repository at this point in the history
* Update docker_build.sh

* Update docker_build.sh

Don't overwrite RC

* Update docker_build.sh

Not all redhat containers have the groups

* Update docker_build.sh

* Update docker_build.sh

* Update docker_build.sh

* Update docker_build.sh

* Update docker_build.sh
  • Loading branch information
dwighthubbard authored Feb 1, 2019
1 parent efcc318 commit afff951
Showing 1 changed file with 47 additions and 15 deletions.
62 changes: 47 additions & 15 deletions invirtualenv_plugins/docker_scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,32 @@ if [ "$LANG" = "" ]; then
export LANG="en_US.UTF-8"
fi

function header {
echo "========================================================================"
echo "$1"
echo "========================================================================"

}

function init_directories {
mkdir -p "/var/lib/virtualenvs"
mkdir -p "${INVIRTUALENV_DIR}"
}

function init_alpine {
echo "Configuring container for alpine packaging"
header "Configuring container for alpine packaging"
apk add python3 python3-dev coreutils zip gcc libxml2 libxslt musl-dev libxslt-dev linux-headers make
VENV_COMMAND="python3 -m venv"
}

function init_debian {
echo "Configuring container for debian packaging"
header "Configuring container for debian packaging"
DEBIAN_FRONTEND="noninteractive"
export DEBIAN_FRONTEND
apt-get update
apt-get upgrade -y

set +e
apt-get install -y python3-dev python3-venv build-essential
RC="$?"
set -e
apt-get install -y python3-dev python3-venv build-essential || RC="$?"
if [ "$RC" != "0" ]; then
apt-get install -y python-dev python-pip python-virtualenv build-essential
VENV_COMMAND="virtualenv"
Expand All @@ -41,32 +45,55 @@ function init_debian {
}

function init_rpm {
echo "Configuring container for rpm packaging"
header "Configuring container for rpm packaging"
VENV_COMMAND="virtualenv"
# yum upgrade -y
yum groupinstall -y 'development tools'
set +e
yum install -y python3-devel python3 python3-virtualenv
RC="$?"
set -e
yum clean all
yum install -y apr apr-util autoconf automake \
bison byacc \
cscope ctags \
diffstat doxygen \
flex \
gcc gcc-gfortran \
indent intltool \
libtool \
patchutils \
rcs \
subversion swig \
python3-devel python3 python3-virtualenv || RC="$?"
yum clean all
if [ "$RC" != "0" ]; then
yum install -y python-devel python-virtualenv
echo "Unable to bootstrap python3, switching to python2"
yum install -y apr apr-util autoconf automake \
bison byacc \
cscope ctags \
diffstat doxygen \
flex \
gcc gcc-gfortran \
indent intltool \
libtool \
patchutils \
rcs \
subversion swig \
python-devel python-virtualenv && yum clean all
fi
}

function install_invirtualenv {
echo "Bootstrapping the invirtualenv package"
header "Bootstrapping the invirtualenv package"
$VENV_COMMAND "${INSTALLVENV}"
source "${INSTALLVENV}/bin/activate"
venv_pip="${INSTALLVENV}/bin/pip"

${venv_pip} install -U setuptools
${venv_pip} install -U wheel virtualenv
${venv_pip} install "pip<19.0"
${venv_pip} install -U invirtualenv
deactivate || true
}

function deploy {
echo "Deploying application virtualenv"
header "Deploying application virtualenv"
cwd="`pwd`"
cd "${INVIRTUALENV_DIR}"
cat deploy.conf
Expand All @@ -91,6 +118,11 @@ if [ -e "/sbin/apk" ]; then
fi

install_invirtualenv

deploy

if [ -e "/usr/bin/yum" ]; then
header "Cleaning up yum metadata"
yum clean all
fi
exit 0

0 comments on commit afff951

Please sign in to comment.