Skip to content

Instantly share code, notes, and snippets.

@dimitri
Created December 22, 2021 13:36
Show Gist options
  • Save dimitri/009d2d73499ed2cbb6eeca2ef70d9fda to your computer and use it in GitHub Desktop.
Save dimitri/009d2d73499ed2cbb6eeca2ef70d9fda to your computer and use it in GitHub Desktop.
pg_auto_failover debian packaging build scripts
FROM debian:sid
ENV TAR v1.6.3.tar.gz
ENV ORIG pg-auto-failover_1.6.3.orig.tar.gz
ENV WORKDIR /usr/src/pg_auto_failover-1.6.3
ENV ARCHIVE https://github.com/citusdata/pg_auto_failover/archive/refs/tags/
ENV RELEASE ${ARCHIVE}${TAR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
devscripts \
debhelper \
autotools-dev \
flex \
libedit-dev \
libpam0g-dev \
libreadline-dev \
libselinux1-dev \
libxslt1-dev \
libssl-dev \
libkrb5-dev \
zlib1g-dev \
liblz4-dev \
postgresql-server-dev-all \
postgresql-common \
python3-sphinx \
lintian \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src
RUN curl -L -o ${TAR} ${RELEASE}
RUN tar xf ${TAR}
RUN mv ${TAR} ${ORIG}
WORKDIR ${WORKDIR}
COPY pgaf_debian/debian/ ./debian/
RUN pg_buildext updatecontrol
RUN dpkg-buildpackage --no-sign
WORKDIR /usr/src
#RUN lintian --suppress-tags bad-whatis-entry *.changes
FROM debian:sid
ENV PGVERSION 13
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
make \
sudo \
tmux \
watch \
lsof \
psutils \
dnsutils \
bind9-host \
postgresql-common \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
RUN apt-get update\
&& apt-get install -y --no-install-recommends \
postgresql-${PGVERSION} \
postgresql-${PGVERSION}-auto-failover \
pg-auto-failover-cli \
&& rm -rf /var/lib/apt/lists/*
DOCKER_CONTAINER_NAME = pgaf_debian
DOCKER_CONTAINER_NAME_QA = pgaf_debian_qa
build:
docker build -t $(DOCKER_CONTAINER_NAME) .
sh:
docker run --rm -it $(DOCKER_CONTAINER_NAME) bash
qa:
docker build -t $(DOCKER_CONTAINER_NAME_QA) -f Dockerfile.qa .
docker run --rm -it $(DOCKER_CONTAINER_NAME_QA) bash
.PHONY: build sh qa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment