mirror of
https://github.com/EpicMorg/docker-scripts.git
synced 2024-12-25 06:05:37 +03:00
added backported postgres
This commit is contained in:
parent
d7d5578979
commit
0449ea49f5
44
postgres/8.4/Dockerfile
Normal file
44
postgres/8.4/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 8.4
|
||||||
|
ENV PG_VERSION 8.4.22-1.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/8.4/docker-entrypoint.sh
Executable file
24
postgres/8.4/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
44
postgres/9.0/Dockerfile
Normal file
44
postgres/9.0/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 9.0
|
||||||
|
ENV PG_VERSION 9.0.18-1.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/9.0/docker-entrypoint.sh
Executable file
24
postgres/9.0/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
44
postgres/9.1/Dockerfile
Normal file
44
postgres/9.1/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 9.1
|
||||||
|
ENV PG_VERSION 9.1.14-1.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/9.1/docker-entrypoint.sh
Executable file
24
postgres/9.1/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
44
postgres/9.2/Dockerfile
Normal file
44
postgres/9.2/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 9.2
|
||||||
|
ENV PG_VERSION 9.2.9-1.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/9.2/docker-entrypoint.sh
Executable file
24
postgres/9.2/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
44
postgres/9.3/Dockerfile
Normal file
44
postgres/9.3/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 9.3
|
||||||
|
ENV PG_VERSION 9.3.5-1.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/9.3/docker-entrypoint.sh
Executable file
24
postgres/9.3/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
44
postgres/9.4/Dockerfile
Normal file
44
postgres/9.4/Dockerfile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR 9.4
|
||||||
|
ENV PG_VERSION 9.4~beta2-2~129.bzr487.pgdg70+1
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
24
postgres/9.4/docker-entrypoint.sh
Executable file
24
postgres/9.4/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
6
postgres/AUTHORS
Normal file
6
postgres/AUTHORS
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Docker PostgreSQL Authors <pgsql-pkg-docker@postgresql.org>
|
||||||
|
|
||||||
|
Tianon Gravi <admwiggin@gmail.com>
|
||||||
|
Joseph Ferguson <yosifkit@gmail.com>
|
||||||
|
|
||||||
|
And other contributors not specifically named here.
|
44
postgres/Dockerfile.template
Normal file
44
postgres/Dockerfile.template
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# vim:set ft=dockerfile:
|
||||||
|
FROM debian:wheezy
|
||||||
|
|
||||||
|
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||||
|
RUN groupadd -r postgres && useradd -r -g postgres postgres
|
||||||
|
|
||||||
|
# grab gosu for easy step-down from root
|
||||||
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
|
||||||
|
&& chmod +x /usr/local/bin/gosu \
|
||||||
|
&& apt-get purge -y --auto-remove curl
|
||||||
|
|
||||||
|
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||||
|
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||||
|
|
||||||
|
ENV PG_MAJOR %%PG_MAJOR%%
|
||||||
|
ENV PG_VERSION %%PG_VERSION%%
|
||||||
|
|
||||||
|
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y postgresql-common \
|
||||||
|
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
||||||
|
&& apt-get install -y \
|
||||||
|
postgresql-$PG_MAJOR=$PG_VERSION \
|
||||||
|
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
|
||||||
|
ENV PGDATA /var/lib/postgresql/data
|
||||||
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
|
CMD ["postgres"]
|
22
postgres/LICENSE
Normal file
22
postgres/LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Copyright (c) 2014, Docker PostgreSQL Authors (See AUTHORS)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
postgres/docker-entrypoint.sh
Executable file
24
postgres/docker-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'postgres' ]; then
|
||||||
|
chown -R postgres "$PGDATA"
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
||||||
|
gosu postgres initdb
|
||||||
|
|
||||||
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
||||||
|
|
||||||
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
||||||
|
|
||||||
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
||||||
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
||||||
|
[ -f "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec gosu postgres "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
27
postgres/generate-stackbrew-library.sh
Executable file
27
postgres/generate-stackbrew-library.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
declare -A aliases
|
||||||
|
aliases=(
|
||||||
|
[9.3]='9 latest'
|
||||||
|
[8.4]='8'
|
||||||
|
)
|
||||||
|
|
||||||
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||||
|
|
||||||
|
versions=( */ )
|
||||||
|
versions=( "${versions[@]%/}" )
|
||||||
|
url='git://github.com/docker-library/postgres'
|
||||||
|
|
||||||
|
echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)'
|
||||||
|
|
||||||
|
for version in "${versions[@]}"; do
|
||||||
|
commit="$(git log -1 --format='format:%H' "$version")"
|
||||||
|
fullVersion="$(grep -m1 'ENV PG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3 | cut -d- -f1 | sed 's/~/-/g')"
|
||||||
|
versionAliases=( $fullVersion $version ${aliases[$version]} )
|
||||||
|
|
||||||
|
echo
|
||||||
|
for va in "${versionAliases[@]}"; do
|
||||||
|
echo "$va: ${url}@${commit} $version"
|
||||||
|
done
|
||||||
|
done
|
26
postgres/update.sh
Executable file
26
postgres/update.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||||
|
|
||||||
|
versions=( "$@" )
|
||||||
|
if [ ${#versions[@]} -eq 0 ]; then
|
||||||
|
versions=( */ )
|
||||||
|
fi
|
||||||
|
versions=( "${versions[@]%/}" )
|
||||||
|
|
||||||
|
packagesUrl='http://apt.postgresql.org/pub/repos/apt/dists/wheezy-pgdg/main/binary-amd64/Packages'
|
||||||
|
packages="$(echo "$packagesUrl" | sed -r 's/[^a-zA-Z.-]+/-/g')"
|
||||||
|
curl -sSL "${packagesUrl}.bz2" | bunzip2 > "$packages"
|
||||||
|
|
||||||
|
for version in "${versions[@]}"; do
|
||||||
|
fullVersion="$(grep -m1 -A10 "^Package: postgresql-$version\$" "$packages" | grep -m1 '^Version: ' | cut -d' ' -f2)"
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
cp docker-entrypoint.sh Dockerfile.template "$version/"
|
||||||
|
mv "$version/Dockerfile.template" "$version/Dockerfile"
|
||||||
|
sed -i 's/%%PG_MAJOR%%/'$version'/g; s/%%PG_VERSION%%/'$fullVersion'/g' "$version/Dockerfile"
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "$packages"
|
Loading…
Reference in New Issue
Block a user