Merge "Add Patroni image"

This commit is contained in:
Zuul 2019-05-28 18:44:43 +00:00 committed by Gerrit Code Review
commit 5905c478d2
3 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,31 @@
FROM postgres:9.5
MAINTAINER Alexander Kukushkin <alexander.kukushkin@zalando.de>
RUN export DEBIAN_FRONTEND=noninteractive \
&& echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \
&& apt-get update -y \
&& apt-get upgrade -y \
&& apt-cache depends patroni | sed -n -e 's/.* Depends: \(python3-.\+\)$/\1/p' \
| grep -Ev '^python3-(sphinx|etcd|consul|kazoo|kubernetes)' \
| xargs apt-get install -y vim-tiny curl jq locales git python3-pip python3-wheel \
## Make sure we have a en_US.UTF-8 locale available
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& pip3 install setuptools \
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
&& PGHOME=/home/postgres \
&& mkdir -p $PGHOME \
&& chown postgres $PGHOME \
&& sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \
# Set permissions for OpenShift
&& chmod 775 $PGHOME \
&& chmod 664 /etc/passwd \
# Clean up
&& apt-get remove -y git python3-pip python3-wheel \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /root/.cache
EXPOSE 5432 8008
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EDITOR=/usr/bin/editor
USER postgres
WORKDIR /home/postgres

14
patroni/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="patroni"
VERSION=${VERSION:-latest}
DISTRO=${DISTRO:-ubuntu_xenial}
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 -

57
zuul.d/patroni.yaml Normal file
View File

@ -0,0 +1,57 @@
---
# 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-patroni
gate:
jobs:
- openstack-helm-images-upload-patroni
promote:
jobs:
- openstack-helm-images-promote-patroni
periodic:
jobs:
- openstack-helm-images-build-patroni
- job:
name: openstack-helm-images-build-patroni
parent: openstack-helm-images-build
description: Build patroni images
vars: &patroni_vars
docker_images:
- context: patroni
repository: openstackhelm/patroni
dockerfile: Dockerfile.ubuntu_xenial
tags:
- latest-ubuntu_xenial
files: &patroni_files
- patroni/.*
- zuul.d/patroni.yaml
- job:
name: openstack-helm-images-upload-patroni
parent: openstack-helm-images-upload
description: Build and upload patroni images
vars: *patroni_vars
files: *patroni_files
- job:
name: openstack-helm-images-promote-patroni
parent: openstack-helm-images-promote
description: Promote a previously published patroni image to latest.
vars: *patroni_vars
files: *patroni_files