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.

Dockerfile 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. zlib1g\
  8. libreadline6\
  9. wget\
  10. bison\
  11. flex\
  12. tar\
  13. gzip\
  14. libreadline-dev\
  15. make\
  16. zlib1g-dev\
  17. git &&\
  18. apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  19. RUN wget "https://github.com/postgres/postgres/archive/REL${PG_VERSION_}.tar.gz" &&\
  20. tar xf REL${PG_VERSION_}.tar.gz
  21. RUN cd postgres-REL${PG_VERSION_} &&\
  22. ./configure --prefix=/usr/ &&\
  23. make &&\
  24. make install
  25. RUN apt-get autoremove -y \
  26. wget\
  27. bison\
  28. flex\
  29. libreadline-dev\
  30. make\
  31. zlib1g-dev\
  32. git &&\
  33. rm -rf REL${PG_VERSION_}.tar.gz postgres-REL${PG_VERSION_}
  34. RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
  35. ENV GOSU_VERSION 1.7
  36. RUN set -x \
  37. && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
  38. && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
  39. && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
  40. && export GNUPGHOME="$(mktemp -d)" \
  41. && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
  42. && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
  43. && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
  44. && chmod +x /usr/local/bin/gosu \
  45. && gosu nobody true \
  46. && apt-get purge -y --auto-remove ca-certificates wget
  47. RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
  48. && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
  49. ENV LANG en_US.utf8
  50. RUN mkdir -p /docker-entrypoint-initdb.d /usr/share/postgresql/
  51. RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
  52. RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
  53. ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
  54. ENV PGDATA /var/lib/postgresql/data
  55. 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)
  56. VOLUME /var/lib/postgresql/data
  57. COPY docker-entrypoint.sh /usr/local/bin/
  58. RUN ln -s usr/local/bin/docker-entrypoint.sh /
  59. ENTRYPOINT ["docker-entrypoint.sh"]
  60. EXPOSE 5432
  61. CMD ["postgres"]