Move to single dockerfile

Build-args will control FROM args. Centos, Ubuntu, and Debian will
remain officially supported.

This will completely remove the logic from Dockerfile and put it in the
scripts control which is the direction we have been headed for a while.

Change-Id: I8e0745b50e6c141da5ca8f57b415ae206dad5ab4
This commit is contained in:
Sam Yaple 2017-09-29 14:42:34 -04:00
parent 4efa684783
commit 9ad99a9c95
5 changed files with 24 additions and 49 deletions

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
ARG FROM=ubuntu:xenial
FROM ${FROM}
ENV GENERIC=yes
ENV PATH=/var/lib/openstack/bin:$PATH
ARG PROJECT
ARG WHEELS=openstackloci/requirements:ubuntu
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG DISTRO
ARG PROFILES
ARG PYPI_PACKAGES
COPY scripts /opt/loci/scripts
COPY bindep.txt /opt/loci/
RUN /opt/loci/scripts/install.sh ${PYPI_PACKAGES}

View File

@ -1,26 +0,0 @@
ARG FROM=ubuntu:xenial
FROM ${FROM}
ENV GENERIC=yes
ENV PATH=/var/lib/openstack/bin:$PATH
ARG PROJECT
ARG WHEELS=openstackloci/requirements:ubuntu
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG SCRIPTS_REPO=https://git.openstack.org/openstack/loci
ARG SCRIPTS_REF=master
ARG DISTRO
ARG PROFILES
ARG PYPI_PACKAGES
RUN set -ex; \
apt-get update; \
apt-get upgrade -y; \
apt-get install -y --no-install-recommends \
ca-certificates \
git \
; \
git init /tmp/common/; \
git --git-dir /tmp/common/.git fetch --depth 1 $SCRIPTS_REPO $SCRIPTS_REF; \
git --work-tree /tmp/common --git-dir /tmp/common/.git checkout FETCH_HEAD; \
/tmp/common/scripts/install.sh ${PYPI_PACKAGES}

View File

@ -1,22 +0,0 @@
ARG FROM=centos:7
FROM ${FROM}
ENV GENERIC=yes
ENV PATH=/var/lib/openstack/bin:$PATH
ARG PROJECT
ARG WHEELS=openstackloci/requirements:centos
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG SCRIPTS_REPO=https://git.openstack.org/openstack/loci
ARG SCRIPTS_REF=master
ARG DISTRO
ARG PROFILES
ARG PYPI_PACKAGES
RUN set -ex; \
yum upgrade -y; \
yum install -y git; \
git init /tmp/common/; \
git --git-dir /tmp/common/.git fetch --depth 1 $SCRIPTS_REPO $SCRIPTS_REF; \
git --work-tree /tmp/common --git-dir /tmp/common/.git checkout FETCH_HEAD; \
/tmp/common/scripts/install.sh ${PYPI_PACKAGES}

View File

@ -8,7 +8,11 @@ distro=${DISTRO:=$distro}
case ${distro} in
debian|ubuntu)
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends \
git \
ca-certificates \
netbase \
python \
virtualenv \
@ -16,7 +20,9 @@ case ${distro} in
sudo
;;
centos)
yum upgrade -y
yum install -y \
git \
python-virtualenv \
sudo
;;
@ -51,7 +57,7 @@ $(dirname $0)/pip_install.sh \
if [[ ${generic} == 'yes' ]]; then
$(dirname $0)/pip_install.sh bindep
PACKAGES=($(bindep -f $(dirname $0)/../dockerfiles/bindep.txt -b ${PROJECT} ${PROFILES} || :))
PACKAGES=($(bindep -f /opt/loci/bindep.txt -b ${PROJECT} ${PROFILES} || :))
else
PACKAGES=()
fi