Skip to content

Commit bc7a5bf

Browse files
Test.
1 parent f6d2eb1 commit bc7a5bf

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

9.5/Dockerfile.centos7

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,37 @@ ENV LANG en_US.utf8
2626

2727
RUN mkdir /docker-entrypoint-initdb.d
2828

29-
ENV PG_MAJOR 9.5
30-
ENV PG_MAJOR_NODOT 95
31-
ENV PG_MINOR 3
32-
ENV PGDG_VERSION
33-
ENV PG_VERSION 9.5.${PG_MINOR}
34-
ENV OSV rhel7
29+
ENV PG_REPOURL="https://download.postgresql.org/pub/repos/yum"
30+
ENV PG_MAJOR=9.5 \
31+
PG_MAJOR_NODOT=95 \
32+
PG_MINOR=3 \
33+
PG_REVISION=2
34+
35+
ENV PG_VERSION=${PG_MAJOR}.${PG_MINOR}-${PG_REVISION} \
36+
PGDG_VERSION=${PG_MAJOR}-${PG_REVISION} \
37+
OSV_NAME=rhel7
3538

36-
RUN rpm --import https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG && rpm --import https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-${PG_MAJOR_NODOT}
39+
ENV PG_REPO="${PG_REPOURL}/${PG_MAJOR}/redhat/rhel-7.2-x86_64"
3740

38-
RUN echo -e "[postgres_repo]\nname=Postgres Repo\nbaseurl=https://download.postgresql.org/pub/repos/yum/${PG_MAJOR}/redhat/rhel-7-x86_64\nenabled=1\ngpgcheck=1" > /etc/yum.repos.d/postgres.repo
41+
RUN rpm --import ${PG_REPOURL}/RPM-GPG-KEY-PGDG && rpm --import ${PG_REPOURL}/RPM-GPG-KEY-PGDG-${PG_MAJOR_NODOT}
42+
43+
RUN echo -e "[postgres_repo]\nname=Postgres Repo\nbaseurl=${PG_REPO}\nenabled=1\ngpgcheck=1" > /etc/yum.repos.d/postgres.repo
3944

4045
RUN yum update -y \
41-
&& yum install -y pgdg-centos${PG_MAJOR_NODOT}-${PG_VERSION}PGDG.${OSV}.x86_64 \
42-
&& yum install -y postgresql${PG_MAJOR_NODOT}-server-${PG_VERSION}PGDG.${OSV}.x86_64 \
46+
&& yum install -y ${PG_REPO}/pgdg-centos${PG_MAJOR_NODOT}-${PGDG_VERSION}.noarch.rpm \
47+
&& yum install -y ${PG_REPO}/postgresql${PG_MAJOR_NODOT}-server-${PG_VERSION}PGDG.${OSV_NAME}.x86_64.rpm \
4348
# && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
4449
&& yum install -y \
45-
postgresql postgresql${PG_MAJOR_NODOT}-${PG_VERSION}PGDG.${OSV}.x86_64 \
46-
postgresql${PG_MAJOR_NODOT}-contrib-${PG_VERSION}PGDG.${OSV}.x86_64 \
50+
${PG_REPO}/postgresql${PG_MAJOR_NODOT}-${PG_VERSION}PGDG.${OSV_NAME}.x86_64.rpm \
51+
${PG_REPO}/postgresql${PG_MAJOR_NODOT}-contrib-${PG_VERSION}PGDG.${OSV_NAME}.x86_64.rpm \
4752
&& yum clean all
4853

4954
# make the sample config easier to munge (and "correct by default")
50-
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
51-
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
52-
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
55+
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/pgsql-${PG_MAJOR}/share/postgresql.conf.sample
5356

5457
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
5558

56-
ENV PATH /usr/lib/postgresql/${PG_MAJOR}/bin:$PATH
59+
ENV PATH /usr/pgsql-${PG_MAJOR}/bin:$PATH
5760
ENV PGDATA /var/lib/postgresql/data
5861
VOLUME /var/lib/postgresql/data
5962

0 commit comments

Comments
 (0)