You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. FROM robinthoni/debian-multiarch:jessie
  2. MAINTAINER Robin Thoni <robin@rthoni.com>
  3. ARG PG_VERSION=9.6.3
  4. ARG PG_MAJOR=9.6
  5. ARG PG_VERSION_=9_6_3
  6. RUN apt-get update && apt-get -y install\
  7. wget\
  8. bison\
  9. flex\
  10. tar\
  11. gzip\
  12. libreadline-dev\
  13. git &&\
  14. apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  15. RUN wget "https://github.com/postgres/postgres/archive/REL${PG_VERSION_}.tar.gz" &&\
  16. tar xf REL${PG_VERSION_}.tar.gz
  17. RUN apt-get update
  18. RUN apt-get -y install\
  19. zlib1g-dev\
  20. make
  21. RUN cd postgres-REL${PG_VERSION_} &&\
  22. ./configure --prefix=/usr/ &&\
  23. make &&\
  24. make install
  25. RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
  26. ENV GOSU_VERSION 1.7
  27. RUN set -x \
  28. && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
  29. && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
  30. && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
  31. && export GNUPGHOME="$(mktemp -d)" \
  32. && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
  33. && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
  34. && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
  35. && chmod +x /usr/local/bin/gosu \
  36. && gosu nobody true \
  37. && apt-get purge -y --auto-remove ca-certificates wget
  38. RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
  39. && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
  40. ENV LANG en_US.utf8
  41. RUN mkdir -p /docker-entrypoint-initdb.d /usr/share/postgresql/
  42. RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
  43. RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
  44. ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
  45. ENV PGDATA /var/lib/postgresql/data
  46. RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA" # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
  47. VOLUME /var/lib/postgresql/data
  48. COPY docker-entrypoint.sh /usr/local/bin/
  49. RUN ln -s usr/local/bin/docker-entrypoint.sh /
  50. ENTRYPOINT ["docker-entrypoint.sh"]
  51. EXPOSE 5432
  52. CMD ["postgres"]