ironic-python-agent/Dockerfile
Mathieu Mitchell a0ca6ce157 Enforce upper-constraints when building ramdisks
Currently, building ramdisks installs ironic-python-agent without any
upper-constraints. This causes the package to be installed with newer,
untested dependencies.

This commits introduces a tool to generate a local upper-constraints
file based on predefined strategies (below). Additionally, the fallback
to the openstack/requirements uses the URL defined in tox.ini instead of
redefining it. This prevents having to keep track of two separate
variables when releasing.

upper-constraints lookup strategies (in order):

  * UPPER_CONSTRAINTS_FILE points to a local file
  * UPPER_CONSTRAINTS_FILE points to a URL
  * /opt/stack/new/requirements/upper-constraints.txt
  * upper-constraints.txt from openstack/requirements git repository

Partial-bug: #1616554
Change-Id: Ib5c0c57cafdb6ffd7456e61f3b1bb5fa57520e5a
2016-08-26 09:06:24 -04:00

57 lines
2.5 KiB
Docker

FROM debian:jessie
# The add is before the RUN to ensure we get the latest version of packages
# Docker will cache RUN commands, but because the SHA1 of the dir will be
# different it will not cache this layer
ADD . /tmp/ironic-python-agent
# Copy the proxy.sh script which copies the proxy settings from the host
# environment (if they are set). This file will be dynamically created by
# imagebuild/coreos/docker_build.bash
# TODO(jlvilla): Once Docker 1.9 is widely deployed, switch to using the 'ARG'
# command which was added in Docker 1.9. Currently Ubuntu 14.04 uses Docker
# 1.6. Using the ARG command will be a much cleaner solution.
COPY proxy.sh /usr/bin/proxy.sh
# Ensure we hit a single mirror for builds, since httpredir is flakey
RUN sed -i 's/httpredir/http.us/g' /etc/apt/sources.list
# Add 'backports' for qemu-utils
RUN echo 'deb http://http.us.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list
# Install requirements: Python for ironic-python-agent, others for putting an
# image on disk
RUN proxy.sh apt-get update && \
proxy.sh apt-get -y upgrade && \
proxy.sh apt-get install -y --no-install-recommends gdisk python2.7 python2.7-dev \
python-pip qemu-utils parted hdparm util-linux genisoimage git gcc \
bash coreutils tgt dmidecode ipmitool psmisc dosfstools && \
proxy.sh apt-get --only-upgrade -t jessie-backports install -y qemu-utils
# Some cleanup
RUN proxy.sh apt-get -y autoremove && \
proxy.sh apt-get clean
# Before cleaning mark packages that are required so they are not removed
RUN apt-mark manual python-setuptools
RUN apt-mark manual python-minimal
# Install requirements separately, because pip understands a git+https url
# while setuptools doesn't
RUN proxy.sh pip install --upgrade pip
RUN proxy.sh pip install -c /tmp/ironic-python-agent/upper-constraints.txt --no-cache-dir -r /tmp/ironic-python-agent/requirements.txt
# This will succeed because all the dependencies were installed previously
RUN proxy.sh pip install -c /tmp/ironic-python-agent/upper-constraints.txt --no-cache-dir /tmp/ironic-python-agent
# Remove no longer needed packages
# NOTE(jroll) leave git to avoid strange apt issues in downstream Dockerfiles
# that may inherit from this one.
RUN proxy.sh apt-get -y purge gcc-4.6 gcc python2.7-dev && \
proxy.sh apt-get -y autoremove && \
proxy.sh apt-get clean
RUN rm -rf /tmp/ironic-python-agent
RUN rm -rf /var/lib/apt/lists/*
CMD [ "/usr/local/bin/ironic-python-agent" ]