Makefile and Docker file for ospurge containers

Change-Id: I88318674e11e61740d56ab24c58d460cbe438f32
This commit is contained in:
ad620p 2019-09-17 08:29:48 +00:00
parent e79f83d91d
commit 8a0e8ee04b
6 changed files with 125 additions and 0 deletions

View File

@ -34,6 +34,10 @@ ifeq ($(IMAGE_NAME), calicoctl-utility)
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${CALICOCTL_VERSION}-${IMAGE_TAG}
endif
ifeq ($(IMAGE_NAME), ospurge)
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
endif
# Build Docker image for this project
.PHONY: images
images: build_$(IMAGE_NAME)
@ -72,6 +76,12 @@ else ifeq ($(OS_RELEASE), alpine)
$(EXTRA_BUILD_ARGS) \
-t $(IMAGE) \
.
else ifeq ($(OS_RELEASE), ubuntu_bionic)
docker build -f $(IMAGE_NAME)/Dockerfile.$(OS_RELEASE) \
--network host \
$(EXTRA_BUILD_ARGS) \
-t $(IMAGE) \
.
else
docker build -t $(IMAGE) --network=host $(EXTRA_BUILD_ARGS) -f $(IMAGE_NAME)/Dockerfile.simple \
.

View File

@ -14,4 +14,6 @@ eg:
make IMAGE_NAME=calicoctl-utility OS_RELEASE=alpine
make IMAGE_NAME=ospurge OS_RELEASE=ubuntu_bionic
Note: calicoctl-utlity image only supports alpine OS.

20
doc/source/ospurge.rst Normal file
View File

@ -0,0 +1,20 @@
=================================
ospurge container image
=================================
This container builds a small image with ospurge service and
python-openstackclient utilities for use by the operator.
Manual build
============
Here are the instructions for building the image:
.. literalinclude:: ../../ospurge/build.sh
:language: shell
Alternatively, this step can be performed by running the script directly:
.. code-block:: shell
./ospurge/build.sh

View File

@ -0,0 +1,20 @@
ARG FROM=docker.io/ubuntu:bionic
FROM ${FROM}
LABEL org.opencontainers.image.authors='Openstack-Helm Authors'
LABEL org.opencontainers.image.url='https://git.openstack.com/openstack/openstack-helm-images'
LABEL org.opencontainers.image.documentation='https://git.openstack.com/openstack/openstack-helm-images/blob/master/README_MAKEFILE'
LABEL org.opencontainers.image.source='https://git.openstack.com/openstack/openstack-helm-images'
LABEL org.opencontainers.image.vendor='Openstack-Helm Authors'
LABEL org.opencontainers.image.licenses='BSD-3-Clause'
RUN set -xe \
&& apt-get update && apt-get dist-upgrade -y \
&& apt-get install python3 -y \
&& apt-get install python3-pip -y
RUN pip3 install ospurge \
&& pip3 install python-openstackclient
WORKDIR /tmp
ENTRYPOINT ["/bin/sh", "-c"]

14
ospurge/build.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
SCRIPT=`realpath $0`
SCRIPT_DIR=`dirname ${SCRIPT}`
## Only build from main folder
cd ${SCRIPT_DIR}/..
IMAGE="ospurge"
VERSION=${VERSION:-latest}
DISTRO=${DISTRO:-ubuntu_bionic}
REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"}
EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""}
docker build -f ${IMAGE}/Dockerfile.${DISTRO} --network=host -t ${REGISTRY_URI}${IMAGE}:${VERSION}-${DISTRO}${EXTRA_TAG_INFO} ${extra_build_args} ${IMAGE}
cd -

59
zuul.d/ospurge.yaml Normal file
View File

@ -0,0 +1,59 @@
---
# Copyright 2019, AT&T Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- project:
check:
jobs:
- openstack-helm-images-build-ospurge
gate:
jobs:
- openstack-helm-images-upload-ospurge
promote:
jobs:
- openstack-helm-images-promote-ospurge
periodic:
jobs:
- openstack-helm-images-build-ospurge
- job:
name: openstack-helm-images-build-ospurge
parent: openstack-helm-images-build
description: Build ospurge images
vars: &ospurge_vars
currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
docker_images:
- context: ospurge
repository: openstackhelm/ospurge
dockerfile: Dockerfile.ubuntu_bionic
tags:
- latest
- "{{ currentdate }}"
files: &ospurge_files
- ospurge/.*
- zuul.d/ospurge.yaml
- job:
name: openstack-helm-images-upload-ospurge
parent: openstack-helm-images-upload
description: Build and upload ospurge images
vars: *ospurge_vars
files: *ospurge_files
- job:
name: openstack-helm-images-promote-ospurge
parent: openstack-helm-images-promote
description: Promote a previously published ospurge image to latest.
vars: *ospurge_vars
files: *ospurge_files