File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ # vim:set ft=dockerfile:
2
+ FROM debian:wheezy
3
+
4
+ # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
5
+ RUN groupadd -r postgres && useradd -r -g postgres postgres
6
+
7
+ RUN apt-get update && apt-get install -y curl
8
+
9
+ RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10
+ && chmod +x /usr/local/bin/gosu
11
+
12
+ ENV PG_MAJOR %%PG_MAJOR%%
13
+ ENV PG_VERSION %%PG_VERSION%%
14
+
15
+ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16
+ && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17
+ | apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
18
+
19
+ RUN apt-get update \
20
+ && apt-get install -y postgresql-common \
21
+ && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
22
+ && apt-get install -y \
23
+ postgresql-$PG_MAJOR=$PG_VERSION \
24
+ postgresql-contrib-$PG_MAJOR=$PG_VERSION
25
+
26
+ ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
27
+ ENV PGDATA /var/lib/postgresql/data
28
+ VOLUME /var/lib/postgresql/data
29
+
30
+ ADD ./docker-entrypoint.sh /
31
+
32
+ ENTRYPOINT ["/docker-entrypoint.sh" ]
33
+
34
+ EXPOSE 5432
35
+ CMD ["postgres" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -e
3
+
4
+ cd " $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
5
+
6
+ versions=( " $@ " )
7
+ if [ ${# versions[@]} -eq 0 ]; then
8
+ versions=( * / )
9
+ fi
10
+ versions=( " ${versions[@]%/ } " )
11
+
12
+ packagesUrl=' http://apt.postgresql.org/pub/repos/apt/dists/wheezy-pgdg/main/binary-amd64/Packages'
13
+ packages=" $( echo " $packagesUrl " | sed -r ' s/[^a-zA-Z.-]+/-/g' ) "
14
+ curl -sSL " ${packagesUrl} .bz2" | bunzip2 > " $packages "
15
+
16
+ for version in " ${versions[@]} " ; do
17
+ fullVersion=" $( grep -m1 -A10 " ^Package: postgresql-$version \$ " " $packages " | grep -m1 ' ^Version: ' | cut -d' ' -f2) "
18
+ (
19
+ set -x
20
+ cp Dockerfile.template " $version /Dockerfile"
21
+ sed -i ' s/%%PG_MAJOR%%/' $version ' /g; s/%%PG_VERSION%%/' $fullVersion ' /g' " $version /Dockerfile"
22
+ )
23
+ done
24
+
25
+ rm " $packages "
You can’t perform that action at this time.
0 commit comments