Hook based image build process
Currently the automatic docker image build process builds just 2 types of images all based on Pike release, and the builds are defined on Docker Hub: On master change: Use Dockerfile-master to generate an image with 2 tags: akrog/cinderlib:master akrog/cinderlib:latest On tag creation: Use Dockerfile to generate: akrog/cinderlib:tag This patch changes this mechanism to use hooks for building and pushing, so we can now control our build process directly within the repository under source control, and will be able to build and push multiple images per defined change in Docker Hub. Docker Hub will have 2 ways to trigger image generation, by change in master or by tag creation. The end result is: On master change: Dockerfile ==> akrog/cinderlib:master This image is built using cinderlib:master and cinder:master Dockerfile-latest ==> akrog/cinderlib:latest This image is built using cinderlib:master and cinder:latest_rdo On tag creation: Use Dockerfile-release: akrog/cinderlib:pike akrog/cinderlib:pike_clvX.Y.Z akrog/cinderlib:queens akrog/cinderlib:queens_clvX.Y.Z ... The releases used to build different images on tag creation come from file "rdo-releases". At the time of this commit there is no official RDO Rocky release, so the file only contains pike and queens releases. At some point we may want to remove older releases automatically from Docker Hub, but for now we leave them all to live there.
This commit is contained in:
parent
b0015cbe11
commit
a0b98c9892
28
Dockerfile
28
Dockerfile
|
@ -1,14 +1,28 @@
|
|||
# Based on centos
|
||||
# Based on centos this image builds cinderlib master with Cinder master branch
|
||||
FROM centos:7
|
||||
LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>"
|
||||
LABEL description="Cinderlib"
|
||||
ARG VERSION
|
||||
LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>" \
|
||||
description="Cinderlib" \
|
||||
version=${VERSION:-master}
|
||||
|
||||
RUN yum -y install targetcli iscsi-initiator-utils device-mapper-multipath epel-release lvm2 && \
|
||||
yum -y install python2-pip centos-release-openstack-pike && \
|
||||
yum -y install openstack-cinder python-rbd ceph-common && \
|
||||
yum -y install python2-pip python-devel gcc && \
|
||||
yum -y install python-rbd ceph-common git && \
|
||||
# Need new setuptools version or we'll get "SyntaxError: '<' operator not allowed in environment markers" when installing Cinder
|
||||
pip install 'setuptools>=38.6.0' && \
|
||||
git clone 'https://github.com/openstack/cinder.git' && \
|
||||
pip install --no-cache-dir cinder/ && \
|
||||
pip install --no-cache-dir 'krest>=1.3.0' 'purestorage>=1.6.0' && \
|
||||
rm -rf cinder && \
|
||||
yum -y remove git python-devel gcc && \
|
||||
yum clean all && \
|
||||
rm -rf /var/cache/yum && \
|
||||
pip install --no-cache-dir --process-dependency-links cinderlib 'krest>=1.3.0' 'purestorage>=1.6.0'
|
||||
rm -rf /var/cache/yum
|
||||
|
||||
# Copy cinderlib
|
||||
COPY . /cinderlib
|
||||
|
||||
RUN pip install --no-cache-dir /cinderlib/ && \
|
||||
rm -rf \cinderlib
|
||||
|
||||
# Define default command
|
||||
CMD ["bash"]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# Based on centos this image builds cinderlib master with Cinder master branch
|
||||
FROM centos:7
|
||||
ARG VERSION
|
||||
ARG RELEASE
|
||||
LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>" \
|
||||
description="Cinderlib" \
|
||||
version=${VERSION:-latest}
|
||||
|
||||
RUN yum -y install targetcli iscsi-initiator-utils device-mapper-multipath epel-release lvm2 && \
|
||||
echo yum -y install python2-pip centos-release-openstack-${RELEASE} > /root/whatever && \
|
||||
yum -y install python2-pip centos-release-openstack-${RELEASE} && \
|
||||
yum -y install openstack-cinder python-rbd ceph-common && \
|
||||
pip install --no-cache-dir 'krest>=1.3.0' 'purestorage>=1.6.0' && \
|
||||
yum clean all && \
|
||||
rm -rf /var/cache/yum
|
||||
|
||||
# Copy cinderlib
|
||||
COPY . /cinderlib
|
||||
|
||||
RUN pip install --no-cache-dir /cinderlib/ && \
|
||||
rm -rf \cinderlib
|
||||
|
||||
# Define default command
|
||||
CMD ["bash"]
|
|
@ -1,25 +0,0 @@
|
|||
# Based on centos this image builds cinderlib master with Cinder master branch
|
||||
FROM centos:7
|
||||
LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>"
|
||||
LABEL description="Cinderlib"
|
||||
|
||||
RUN yum -y install targetcli iscsi-initiator-utils device-mapper-multipath epel-release lvm2 && \
|
||||
yum -y install python2-pip python-devel gcc && \
|
||||
yum -y install python-rbd ceph-common git && \
|
||||
# Need new setuptools version or we'll get "SyntaxError: '<' operator not allowed in environment markers" when installing Cinder
|
||||
pip install 'setuptools>=38.6.0' && \
|
||||
git clone 'https://github.com/openstack/cinder.git' && \
|
||||
pip install --no-cache-dir cinder/ && \
|
||||
pip install --no-cache-dir 'krest>=1.3.0' 'purestorage>=1.6.0' && \
|
||||
rm -rf cinder && \
|
||||
yum -y remove git python-devel gcc && \
|
||||
yum clean all && \
|
||||
rm -rf /var/cache/yum
|
||||
|
||||
# Copy cinderlib
|
||||
COPY . /cinderlib
|
||||
|
||||
RUN pip install -e /cinderlib
|
||||
|
||||
# Define default command
|
||||
CMD ["bash"]
|
|
@ -0,0 +1,17 @@
|
|||
# Based on centos
|
||||
FROM centos:7
|
||||
ARG VERSION
|
||||
ARG RELEASE
|
||||
LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>" \
|
||||
description="Cinderlib" \
|
||||
version=${VERSION:-latest}
|
||||
|
||||
RUN yum -y install targetcli iscsi-initiator-utils device-mapper-multipath epel-release lvm2 && \
|
||||
yum -y install python2-pip centos-release-openstack-$RELEASE && \
|
||||
yum -y install openstack-cinder python-rbd ceph-common && \
|
||||
yum clean all && \
|
||||
rm -rf /var/cache/yum && \
|
||||
pip install --no-cache-dir --process-dependency-links cinderlib 'krest>=1.3.0' 'purestorage>=1.6.0'
|
||||
|
||||
# Define default command
|
||||
CMD ["bash"]
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$CACHE_TAG" == "master" ]
|
||||
then
|
||||
cl_release=`git tag --sort=-v:refname|head -1`
|
||||
|
||||
# Build cinderlib master with cinder master
|
||||
echo "Building cinderlib master with Cinder master ..."
|
||||
docker build --build-arg VERSION=$cl_release -t $DOCKER_REPO:master -f Dockerfile .
|
||||
|
||||
# Build cinderlib master with latest supported Cinder stable release
|
||||
release=`tail -1 rdo-releases`
|
||||
echo "Building cinderlib master with Cinder $release ..."
|
||||
docker build --build-arg RELEASE=$release --build-arg VERSION=$cl_release -t $DOCKER_REPO:latest -f Dockerfile-latest .
|
||||
|
||||
else
|
||||
# Build cinderlib latest release with cinder stable branches
|
||||
releases=`cat rdo-releases`
|
||||
while read -r release; do
|
||||
echo "Building $CACHE_TAG with Cinder $release ..."
|
||||
docker build --build-arg RELEASE=$release -t $DOCKER_REPO:$release --build-arg VERSION=$CACHE_TAG -f Dockerfile-release .
|
||||
done <<< "$releases"
|
||||
fi
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Push cinderlib master branches
|
||||
if [ "$CACHE_TAG" == "master" ]
|
||||
then
|
||||
echo "Pushing latest ..."
|
||||
docker push $DOCKER_REPO:latest
|
||||
|
||||
echo "Pushing master ..."
|
||||
docker push $DOCKER_REPO:master
|
||||
|
||||
# Push cinderlib latest release with cinder stable branches
|
||||
else
|
||||
releases=`cat rdo-releases`
|
||||
cl_release=`git tag --sort=-v:refname|head -1`
|
||||
while read -r release; do
|
||||
echo "Pushing $release ..."
|
||||
docker push $DOCKER_REPO:$release
|
||||
|
||||
# Push it also with the cinderlib version tag
|
||||
echo "Pushing $release-cl$cl_release tag ..."
|
||||
docker tag $DOCKER_REPO:$release $DOCKER_REPO:$release-cl$cl_release
|
||||
docker push $DOCKER_REPO:$release-cl$cl_release
|
||||
done <<< "$releases"
|
||||
|
||||
docker tag $DOCKER_REPO:$release $DOCKER_REPO:stable
|
||||
docker push $DOCKER_REPO:stable
|
||||
fi
|
|
@ -0,0 +1,2 @@
|
|||
pike
|
||||
queens
|
Loading…
Reference in New Issue