Add requirements support to generic dockerfile
If the bindep changes upstream merge, then we can collapse alot of this into bindep.txt file as well. For now, manually declaring is fine. Change-Id: I682948b9480a19291f12a827cd3f4afdb943db8e
This commit is contained in:
parent
9ad99a9c95
commit
a0ff102c54
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash -ex
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
git clone ${PROJECT_REPO} /tmp/${PROJECT}
|
||||
git --git-dir /tmp/${PROJECT}/.git fetch ${PROJECT_REPO} ${PROJECT_REF}
|
||||
git --work-tree /tmp/${PROJECT} --git-dir /tmp/${PROJECT}/.git checkout FETCH_HEAD
|
||||
pushd /tmp/${PROJECT}
|
||||
git fetch ${PROJECT_REPO} ${PROJECT_REF}
|
||||
git checkout FETCH_HEAD
|
||||
popd
|
||||
|
|
|
@ -4,7 +4,7 @@ packages=$@
|
|||
|
||||
generic=${GENERIC:=no}
|
||||
distro=$(awk -F= '/^ID=/ {gsub(/\"/, "", $2); print $2}' /etc/*release)
|
||||
distro=${DISTRO:=$distro}
|
||||
export distro=${DISTRO:=$distro}
|
||||
|
||||
case ${distro} in
|
||||
debian|ubuntu)
|
||||
|
@ -32,6 +32,11 @@ case ${distro} in
|
|||
;;
|
||||
esac
|
||||
|
||||
if [[ "${PROJECT}" == 'requirements' ]]; then
|
||||
/opt/loci/scripts/requirements.sh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p /opt/loci/
|
||||
cp $(dirname $0)/{clone_project.sh,pip_install.sh,fetch_wheels.py} /opt/loci/
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ packages=$@
|
|||
|
||||
/opt/loci/fetch_wheels.py
|
||||
|
||||
mkdir -p /tmp/packages
|
||||
mkdir -p /tmp/wheels/
|
||||
# NOTE(SamYaple): We exclude all files starting with '.' as these can be
|
||||
# control files for AUFS which have special meaning on AUFS backed file
|
||||
# stores.
|
||||
tar xf /tmp/wheels.tar.gz --exclude='.*' -C /tmp/packages/ --strip-components=2 root/packages
|
||||
tar xf /tmp/wheels.tar.gz --exclude='.*' -C /tmp/wheels/
|
||||
|
||||
pip install --no-cache-dir --no-index --no-compile --find-links /tmp/packages --constraint /tmp/packages/upper-constraints.txt ${packages[@]}
|
||||
pip install --no-cache-dir --no-index --no-compile --find-links /tmp/wheels/ ${packages[@]}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
# TODO(SamYaple): Switch all of this to bindep once syntax is supported better
|
||||
# NOTE(SamYaple): Ubuntu and Debian have slightly different package lists
|
||||
case ${distro} in
|
||||
debian)
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
git \
|
||||
liberasurecode-dev \
|
||||
libffi-dev \
|
||||
libkrb5-dev \
|
||||
libldap2-dev \
|
||||
libmariadbclient-dev \
|
||||
libnss3-dev \
|
||||
libpq-dev \
|
||||
libsasl2-dev \
|
||||
libssl-dev \
|
||||
libsystemd-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libvirt-dev \
|
||||
libyaml-dev \
|
||||
libz-dev \
|
||||
pkg-config \
|
||||
python-dev \
|
||||
python-pip \
|
||||
python-virtualenv
|
||||
;;
|
||||
ubuntu)
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
git \
|
||||
liberasurecode-dev \
|
||||
libffi-dev \
|
||||
libkrb5-dev \
|
||||
libldap2-dev \
|
||||
libmysqlclient-dev \
|
||||
libnss3-dev \
|
||||
libpq-dev \
|
||||
libsasl2-dev \
|
||||
libssl-dev \
|
||||
libsystemd-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libvirt-dev \
|
||||
libyaml-dev \
|
||||
libz-dev \
|
||||
pkg-config \
|
||||
python-dev \
|
||||
python-pip \
|
||||
python-virtualenv
|
||||
;;
|
||||
centos)
|
||||
yum upgrade -y
|
||||
# NOTE(SamYaple): https://bugs.centos.org/view.php?id=10750
|
||||
yum install -y --setopt=tsflags=docs libffi-devel
|
||||
yum install -y \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
openssl-devel \
|
||||
ca-certificates \
|
||||
git \
|
||||
bzip2 \
|
||||
liberasurecode-devel \
|
||||
openldap-devel \
|
||||
mariadb-devel \
|
||||
nss-devel \
|
||||
postgresql-devel \
|
||||
cyrus-sasl-devel \
|
||||
openssl-devel \
|
||||
libxml2-devel \
|
||||
libxslt-devel \
|
||||
libvirt-devel \
|
||||
libyaml-devel \
|
||||
zlib-devel \
|
||||
pkgconfig \
|
||||
python \
|
||||
python-devel \
|
||||
python-pip \
|
||||
python-virtualenv \
|
||||
libgcrypt \
|
||||
nss-util \
|
||||
systemd-devel
|
||||
;;
|
||||
*)
|
||||
echo "Unknown distro: ${distro}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
/opt/loci/scripts/clone_project.sh
|
||||
|
||||
mv /tmp/requirements/{global-requirements.txt,upper-constraints.txt} /
|
||||
|
||||
python -m virtualenv /builder
|
||||
pip install -U pip
|
||||
pip install -U wheel setuptools
|
||||
pip wheel -w / -r /global-requirements.txt -c /upper-constraints.txt \
|
||||
bindep==2.5.0 \
|
||||
uwsgi
|
||||
|
||||
# NOTE(SamYaple): We want to purge all files that are not wheels or txt to
|
||||
# reduce the size of the layer to only what is needed
|
||||
shopt -s extglob
|
||||
rm -rf /!(*whl|*txt) > /dev/null 2>&1 || :
|
Loading…
Reference in New Issue